[mutter/gnome-3-36] wayland/subsurface: Handle node unlinking on parent destroyed



commit 62474e3b3fd965b3b8b2458d424ef75b17bbd59f
Author: Robert Mader <robert mader posteo de>
Date:   Fri Aug 6 13:10:52 2021 +0200

    wayland/subsurface: Handle node unlinking on parent destroyed
    
    It concerns subsurface state and the subsurface already listenes
    for the parent to get destroyed.
    
    Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1958>

 src/wayland/meta-wayland-subsurface.c |  1 +
 src/wayland/meta-wayland-surface.c    | 16 +---------------
 2 files changed, 2 insertions(+), 15 deletions(-)
---
diff --git a/src/wayland/meta-wayland-subsurface.c b/src/wayland/meta-wayland-subsurface.c
index de336f60f5..933eedfd82 100644
--- a/src/wayland/meta-wayland-subsurface.c
+++ b/src/wayland/meta-wayland-subsurface.c
@@ -490,6 +490,7 @@ surface_handle_parent_surface_destroyed (struct wl_listener *listener,
                                                  surface,
                                                  sub.parent_destroy_listener);
 
+  g_node_unlink (surface->subsurface_branch_node);
   surface->sub.parent = NULL;
 }
 
diff --git a/src/wayland/meta-wayland-surface.c b/src/wayland/meta-wayland-surface.c
index aecaac4cec..1dcc68b351 100644
--- a/src/wayland/meta-wayland-surface.c
+++ b/src/wayland/meta-wayland-surface.c
@@ -1304,13 +1304,6 @@ meta_wayland_surface_notify_unmapped (MetaWaylandSurface *surface)
   g_signal_emit (surface, surface_signals[SURFACE_UNMAPPED], 0);
 }
 
-static void
-unlink_note (GNode    *node,
-             gpointer  data)
-{
-  g_node_unlink (node);
-}
-
 static void
 wl_surface_destructor (struct wl_resource *resource)
 {
@@ -1359,14 +1352,7 @@ wl_surface_destructor (struct wl_resource *resource)
   if (surface->wl_subsurface)
     wl_resource_destroy (surface->wl_subsurface);
 
-  if (surface->subsurface_branch_node)
-    {
-      g_node_children_foreach (surface->subsurface_branch_node,
-                               G_TRAVERSE_NON_LEAVES,
-                               unlink_note,
-                               NULL);
-      g_clear_pointer (&surface->subsurface_branch_node, g_node_destroy);
-    }
+  g_clear_pointer (&surface->subsurface_branch_node, g_node_destroy);
 
   g_hash_table_destroy (surface->shortcut_inhibited_seats);
 


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