From ce5cea86790ab2522fed8221d0311ca1b5424cc9 Mon Sep 17 00:00:00 2001 From: Window Maker Date: Sat, 23 May 2026 21:29:38 +0200 Subject: [PATCH] wayland: destroy fb->tree in wl_frame_destroy MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Frame_bufs that owned a wlr_scene_tree (top-level frames and the fake_leader for dialogs) leaked their tree on destroy. The scene_buf was destroyed but the tree remained in the scene graph as an orphan, causing stale rendering — most visibly as ghost titlebars near the clip after closing a menu, since the leaked menu frame trees stayed in the scene. --- src/backend/wayland/wl_backend.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/backend/wayland/wl_backend.c b/src/backend/wayland/wl_backend.c index 4e70cfe..5cfa8ad 100644 --- a/src/backend/wayland/wl_backend.c +++ b/src/backend/wayland/wl_backend.c @@ -4265,8 +4265,14 @@ wl_frame_destroy(WScreen *scr, WNativeWindow win) struct wl_frame_buf *fb = frame_buf_find(win); if (!fb) return; W_UnregisterBacking(fb->id); + /* Destroy the scene_buf and (if any) the tree. Without destroying + * the tree, leaked tree nodes accumulate in the scene graph and + * can cause stale rendering or hit-testing issues (e.g. ghost + * titlebars after a menu is closed). */ if (fb->scene_buf) wlr_scene_node_destroy(&fb->scene_buf->node); + if (fb->tree) + wlr_scene_node_destroy(&fb->tree->node); wl_list_remove(&fb->link); wlr_buffer_drop(&fb->base); }