From f606558698474f81653e5668c81561a5c3648299 Mon Sep 17 00:00:00 2001 From: lkn Date: Sat, 6 Jun 2026 12:03:35 +0200 Subject: [PATCH] fix: also check scene_buf NULL to detect stale WINGs frame_bufs (parent frame can also leak, making parent_id check insufficient) --- src/backend/wayland/wl_xdg.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/backend/wayland/wl_xdg.c b/src/backend/wayland/wl_xdg.c index 54aa08e..44fddf2 100644 --- a/src/backend/wayland/wl_xdg.c +++ b/src/backend/wayland/wl_xdg.c @@ -241,9 +241,12 @@ handle_toplevel_map(struct wl_listener *listener, void *data) struct wl_frame_buf *_fb, *_next; wl_list_for_each_safe(_fb, _next, &wl_state.frame_list, link) { if (_fb->id >= 0x20000000 && !wl_find_view_by_id(_fb->id)) { - /* Stale WINGs frame_buf from a previous session whose - * parent toplevel no longer exists — clean it up. */ - if (_fb->parent_id && !frame_buf_find(_fb->parent_id)) { + /* Stale WINGs frame_buf from a previous session — clean it + * up if its scene buffer was auto-destroyed (parent tree was + * destroyed, cascade nulled the pointer) or if the parent + * frame no longer exists. */ + if (!_fb->scene_buf || + (_fb->parent_id && !frame_buf_find(_fb->parent_id))) { W_UnregisterBacking(_fb->id); wl_list_remove(&_fb->link); wlr_buffer_drop(&_fb->base);