fix: destroy frame_bufs in handle_toplevel_destroy so they do not leak between WPrefs launches

This commit is contained in:
lkn 2026-06-06 14:19:33 +02:00
parent f606558698
commit 74a4314621
1 changed files with 21 additions and 0 deletions

View File

@ -434,7 +434,28 @@ handle_toplevel_destroy(struct wl_listener *listener, void *data)
wfree(view->wm_command[ci]);
wfree(view->wm_command);
}
/* Save frame_id before freeing view */
WNativeWindow frame_id = view->frame_id;
wfree(view);
/* Destroy the frame_buf for this window and any orphaned children.
* Without this, frame_bufs leak in wl_state.frame_list and on the
* next launch the WINGs dialog detection finds a stale 0x20000000+
* frame_buf, skips wManageWindow, and the window gets no titlebar. */
if (frame_id) {
struct wl_frame_buf *_fb, *_next;
wl_list_for_each_safe(_fb, _next, &wl_state.frame_list, link) {
if (_fb->id == frame_id || _fb->parent_id == frame_id) {
if (_fb->scene_buf)
wlr_scene_node_destroy(&_fb->scene_buf->node);
if (_fb->tree)
wlr_scene_node_destroy(&_fb->tree->node);
W_UnregisterBacking(_fb->id);
wl_list_remove(&_fb->link);
wlr_buffer_drop(&_fb->base);
}
}
}
}
/*