From be4bf8da9ca85b6d23f2773a6c95cd9de25b425d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michel=20D=C3=A4nzer?= Date: Fri, 3 May 2024 17:57:40 +0200 Subject: [PATCH] wayland/surface: Keep applied sub-surface branch node linked up Until this surface or its parent is finalized. This makes sure that any `MetaWaylandSubsurfacePlacementOp` referencing this surface for sibling will be applied as intended. Part-of: --- src/wayland/meta-wayland-surface.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/wayland/meta-wayland-surface.c b/src/wayland/meta-wayland-surface.c index dd306835c..c9b921583 100644 --- a/src/wayland/meta-wayland-surface.c +++ b/src/wayland/meta-wayland-surface.c @@ -701,8 +701,6 @@ meta_wayland_surface_apply_placement_ops (MetaWaylandSurface *parent, MetaWaylandSurface *surface = op->surface; GNode *sibling_node; - g_node_unlink (surface->applied_state.subsurface_branch_node); - if (!op->sibling) { surface->applied_state.parent = NULL; @@ -711,6 +709,8 @@ meta_wayland_surface_apply_placement_ops (MetaWaylandSurface *parent, surface->applied_state.parent = parent; + g_node_unlink (surface->applied_state.subsurface_branch_node); + if (op->sibling == parent) sibling_node = parent->applied_state.subsurface_leaf_node; else @@ -1520,6 +1520,7 @@ meta_wayland_surface_finalize (GObject *object) { MetaWaylandSurface *surface = META_WAYLAND_SURFACE (object); MetaWaylandCompositor *compositor = surface->compositor; + MetaWaylandSurface *subsurface_surface; MetaWaylandFrameCallback *cb, *next; g_clear_object (&surface->scanout_candidate); @@ -1555,6 +1556,10 @@ meta_wayland_surface_finalize (GObject *object) meta_wayland_surface_discard_presentation_feedback (surface); + META_WAYLAND_SURFACE_FOREACH_SUBSURFACE (&surface->applied_state, + subsurface_surface) + g_node_unlink (subsurface_surface->applied_state.subsurface_branch_node); + g_clear_pointer (&surface->applied_state.subsurface_branch_node, g_node_destroy); g_hash_table_destroy (surface->shortcut_inhibited_seats);