wayland: destroy fb->tree in wl_frame_destroy

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.
This commit is contained in:
Window Maker 2026-05-23 21:29:38 +02:00
parent c7e2b7ba88
commit ce5cea8679
1 changed files with 6 additions and 0 deletions

View File

@ -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);
}