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