wayland: Don't insta-crash when a surface gets disposed
authorBenjamin Otte <otte@redhat.com>
Sun, 16 Apr 2023 02:36:12 +0000 (04:36 +0200)
committerMatthias Clasen <mclasen@redhat.com>
Fri, 21 Apr 2023 07:23:26 +0000 (09:23 +0200)
We want to remove the event queue from the list of event queues, not the
surface.
Otherwise the freed queue stays in the list and the next time an event
comes in, we access invalid memory.

Fixes thinko introduced in commit 7fafa5133b5.

Luckily, we leak all surfaces, so this problem never occured.

gdk/wayland/gdksurface-wayland.c

index a76a2c7247ea8a1435addd758af7971f1d338515..40b136cb9830e933d15954fc413e63471b0874b2 100644 (file)
@@ -632,7 +632,7 @@ gdk_wayland_surface_dispose (GObject *object)
         GDK_WAYLAND_DISPLAY (gdk_surface_get_display (surface));
 
       display_wayland->event_queues =
-        g_list_remove (display_wayland->event_queues, surface);
+        g_list_remove (display_wayland->event_queues, impl->event_queue);
       g_clear_pointer (&impl->event_queue, wl_event_queue_destroy);
     }