[mutter/wip/carlosg/unlink-listeners: 26/28] wayland: Ensure to unlink destroy listeners after destruction




commit 51064c1b4e46be180d4aa9b3fcfd57a6ea7ea615
Author: Carlos Garnacho <carlosg gnome org>
Date:   Fri Aug 19 17:08:42 2022 +0200

    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: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2588>

 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 c8cf8f5c4b..d6c28ff331 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);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]