1
0
Fork 0

wayland: Double check surface/window before looking for modals

While it should not be expected that we pick the pointer into a
MetaSurfaceActor that is disembodied of its MetaWaylandSurface/MetaWindow,
the paths where this should be enforced are somewhat scattered.

So account for the situation in picking code, and prefer a NULL surface
over a crash. This operates on the assumption that this inconsistent state
where Mutter didn't know better to pick a correct surface actor will be fixed
by later crossing events resolving the intermediate state, and that no
other input events will be received meanwhile.

Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/3393
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3729>
(cherry picked from commit e731f2a055)
This commit is contained in:
Carlos Garnacho 2024-05-02 13:23:54 +02:00 committed by Jonas Ådahl
parent 2f4dc03451
commit e1efc4c64e

View file

@ -600,10 +600,13 @@ repick_for_event (MetaWaylandPointer *pointer,
{
MetaSurfaceActorWayland *actor_wayland =
META_SURFACE_ACTOR_WAYLAND (actor);
MetaWindow *window = NULL;
surface = meta_surface_actor_wayland_get_surface (actor_wayland);
if (surface)
window = meta_wayland_surface_get_window (surface);
if (surface && meta_window_has_modals (meta_wayland_surface_get_window (surface)))
if (window && meta_window_has_modals (window))
surface = NULL;
}
else