window-drag: Check whether window is set when hiding tile preview

In the case where we early-out from meta_window_drag_begin(), the
effective_drag_window might not be set yet. In this case, we might finalize
the object before effective_drag_window is set, leading to a NULL pointer
when accessing window->display in hide_tile_preview().

To avoid that crash, add a check whether the window is set already. If no
window is set, we can just skip hiding the preview anyway.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2858>
This commit is contained in:
Jonas Dreßler 2023-02-02 13:55:08 +01:00 committed by Marge Bot
parent 36ae716e4d
commit 65b93e1d45

View File

@ -165,6 +165,7 @@ hide_tile_preview (MetaWindowDrag *window_drag)
window_drag->preview_tile_mode = META_TILE_NONE;
window = meta_window_drag_get_window (window_drag);
if (window)
meta_compositor_hide_tile_preview (window->display->compositor);
}