From 0ee9fce25a45325dd8e6b5c3043308ed20e86992 Mon Sep 17 00:00:00 2001 From: GalenYost Date: Tue, 21 Apr 2026 20:07:53 +0300 Subject: [PATCH] Fix segfault and visual glitch in client_to_desktop Reordered save_desktop calls to prevent desynced linked list state which caused a segmentation fault. Added XUnmapWindow to fix ghost window persistence after moving a client to another workspace. --- catwm.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/catwm.c b/catwm.c index 1c29b16..2762789 100755 --- a/catwm.c +++ b/catwm.c @@ -189,20 +189,21 @@ void change_desktop(const Arg arg) { } void client_to_desktop(const Arg arg) { - client *tmp = current; - int tmp2 = current_desktop; - if(arg.i == current_desktop || current == NULL) return; - // Add client to desktop + Window w = current->win; + int tmp2 = current_desktop; + + remove_window(w); + XUnmapWindow(dis, w); // Fix visual window persistance glitch + save_desktop(tmp2); // Fix syncing issue to prevent segfault + select_desktop(arg.i); - add_window(tmp->win); + add_window(w); save_desktop(arg.i); - // Remove client from current desktop select_desktop(tmp2); - remove_window(current->win); tile(); update_current();