From 258123335177640a70e05e04b2b34f1f07d2ccd4 Mon Sep 17 00:00:00 2001 From: lkn Date: Tue, 23 Jun 2026 23:01:24 +0200 Subject: [PATCH] fix appicon state: destroy WApplication before wUnmanageWindow wApplicationDestroy needs main_window_desc (the wwin) to clean up the appicon and remove the app from the screen list. Call it before wUnmanageWindow which frees wwin. This restores the appicon to "not running" state when a Wayland client closes. --- src/backend/wayland/wl_xdg.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/backend/wayland/wl_xdg.c b/src/backend/wayland/wl_xdg.c index cabd0e6..173ed30 100644 --- a/src/backend/wayland/wl_xdg.c +++ b/src/backend/wayland/wl_xdg.c @@ -402,7 +402,15 @@ handle_toplevel_unmap(struct wl_listener *listener, void *data) WObjDescriptor *desc = wm_backend->context_find(view->id, WM_CTX_CLIENT_WIN); if (desc && desc->parent_type == WCLASS_WINDOW) { WWindow *wwin = (WWindow *)desc->parent; + WNativeWindow main_win = wwin->main_window; wwin->flags.destroyed = 1; + /* Destroy app BEFORE unmanage so wApplicationDestroy can + * still access main_window_desc (which unmanage frees). */ + WApplication *app = wApplicationOf(main_win); + if (app) { + app->refcount = 0; + wApplicationDestroy(app); + } wUnmanageWindow(wwin, False, True); } }