From 79404e419f627d5ad3583cc836d4a64054c5014a Mon Sep 17 00:00:00 2001 From: bakkeby Date: Thu, 2 May 2024 22:08:16 +0200 Subject: [PATCH] Fix for dwm crashing following unmapping of systray window that had been moved to another monitor ref. #423 --- dwm.c | 4 +++- patch/seamless_restart.c | 12 ++++++------ 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/dwm.c b/dwm.c index f4e52f0..e65d521 100644 --- a/dwm.c +++ b/dwm.c @@ -2516,8 +2516,10 @@ manage(Window w, XWindowAttributes *wa) #endif // CENTER_TRANSIENT_WINDOWS_PATCH | CENTER_TRANSIENT_WINDOWS_BY_PARENT_PATCH | CENTER_PATCH } else { #if SEAMLESS_RESTART_PATCH - if (!settings_restored) + if (!settings_restored || c->mon == NULL) { c->mon = selmon; + settings_restored = 0; + } #else c->mon = selmon; #endif // SEAMLESS_RESTART_PATCH diff --git a/patch/seamless_restart.c b/patch/seamless_restart.c index 2be269e..9c1d8f0 100644 --- a/patch/seamless_restart.c +++ b/patch/seamless_restart.c @@ -39,12 +39,12 @@ persistclientstate(Client *c) int restoreclientstate(Client *c) { - return getclienttags(c) - | getclientfields(c) - #if SAVEFLOATS_PATCH - | restorewindowfloatposition(c, c->mon ? c->mon : selmon) - #endif // SAVEFLOATS_PATCH - ; + int restored = getclientfields(c); + getclienttags(c); + #if SAVEFLOATS_PATCH + restorewindowfloatposition(c, c->mon ? c->mon : selmon); + #endif // SAVEFLOATS_PATCH + return restored; } void setmonitorfields(Monitor *m)