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)
committerBenjamin Otte <otte@redhat.com>
Sun, 16 Apr 2023 17:28:21 +0000 (19:28 +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 36aac757b04bd9f61b8986f7fd9bf44d489de6d5..0389822f80fa6b8ea5ecd5f8a6737a4aec3675ba 100644 (file)
@@ -556,7 +556,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);
     }