wayland: Handle reentrancy invalidating touch foci

The hashtable containing per-sequence touch info may change while
invalidating the focus, so grab a copy first of the existing sequences.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4166>
This commit is contained in:
Carlos Garnacho 2024-12-05 10:36:46 +01:00 committed by Marge Bot
parent f28f31fc32
commit c9fa30c55b

View File

@ -176,14 +176,15 @@ meta_wayland_input_invalidate_all_focus (MetaWaylandInput *input,
if (meta_wayland_seat_has_touch (seat)) if (meta_wayland_seat_has_touch (seat))
{ {
ClutterEventSequence *sequence; g_autoptr (GList) touches = NULL;
GList *l;
device = clutter_seat_get_pointer (clutter_seat); device = clutter_seat_get_pointer (clutter_seat);
handler = wl_container_of (input->event_handler_list.next, handler, link); handler = wl_container_of (input->event_handler_list.next, handler, link);
g_hash_table_iter_init (&iter, seat->touch->touches); touches = g_hash_table_get_keys (seat->touch->touches);
while (g_hash_table_iter_next (&iter, (gpointer *) &sequence, NULL)) for (l = touches; l; l = l->next)
meta_wayland_event_handler_invalidate_focus (handler, device, sequence); meta_wayland_event_handler_invalidate_focus (handler, device, l->data);
} }
if (meta_wayland_seat_has_touch (seat) && if (meta_wayland_seat_has_touch (seat) &&