From c9fa30c55b74fa94c2dade13d2b534538076ad1c Mon Sep 17 00:00:00 2001 From: Carlos Garnacho Date: Thu, 5 Dec 2024 10:36:46 +0100 Subject: [PATCH] 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: --- src/wayland/meta-wayland-input.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/wayland/meta-wayland-input.c b/src/wayland/meta-wayland-input.c index 67d1f90d0..066aa9b92 100644 --- a/src/wayland/meta-wayland-input.c +++ b/src/wayland/meta-wayland-input.c @@ -176,14 +176,15 @@ meta_wayland_input_invalidate_all_focus (MetaWaylandInput *input, if (meta_wayland_seat_has_touch (seat)) { - ClutterEventSequence *sequence; + g_autoptr (GList) touches = NULL; + GList *l; device = clutter_seat_get_pointer (clutter_seat); handler = wl_container_of (input->event_handler_list.next, handler, link); - g_hash_table_iter_init (&iter, seat->touch->touches); - while (g_hash_table_iter_next (&iter, (gpointer *) &sequence, NULL)) - meta_wayland_event_handler_invalidate_focus (handler, device, sequence); + touches = g_hash_table_get_keys (seat->touch->touches); + for (l = touches; l; l = l->next) + meta_wayland_event_handler_invalidate_focus (handler, device, l->data); } if (meta_wayland_seat_has_touch (seat) &&