From 51064c1b4e46be180d4aa9b3fcfd57a6ea7ea615 Mon Sep 17 00:00:00 2001 From: Carlos Garnacho Date: Fri, 19 Aug 2022 17:08:42 +0200 Subject: [PATCH] wayland: Ensure to unlink destroy listeners after destruction This is missed in some wl_listeners added through wl_resource_add_destroy_listener(). Ensure this is done consistently for all notify functions. Part-of: --- src/wayland/meta-wayland-data-device.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/wayland/meta-wayland-data-device.c b/src/wayland/meta-wayland-data-device.c index c8cf8f5c4..d6c28ff33 100644 --- a/src/wayland/meta-wayland-data-device.c +++ b/src/wayland/meta-wayland-data-device.c @@ -173,11 +173,13 @@ unset_selection_source (MetaWaylandDataDevice *data_device, } static void -destroy_drag_focus (struct wl_listener *listener, void *data) +destroy_drag_focus (struct wl_listener *listener, + void *data) { MetaWaylandDragGrab *grab = wl_container_of (listener, grab, drag_focus_listener); grab->drag_focus_data_device = NULL; + wl_list_remove (&grab->drag_focus_listener.link); g_clear_signal_handler (&grab->drag_focus_destroy_handler_id, grab->drag_focus); @@ -560,12 +562,14 @@ drag_grab_data_source_destroyed (gpointer data, GObject *where_the_object_was) } static void -destroy_data_device_icon (struct wl_listener *listener, void *data) +destroy_data_device_icon (struct wl_listener *listener, + void *data) { MetaWaylandDragGrab *drag_grab = wl_container_of (listener, drag_grab, drag_icon_listener); drag_grab->drag_surface = NULL; + wl_list_remove (&drag_grab->drag_icon_listener.link); if (drag_grab->feedback_actor) clutter_actor_remove_all_children (drag_grab->feedback_actor);