From 035447b08f3b2db1d370422a9d8a3b53c88a2cc8 Mon Sep 17 00:00:00 2001 From: nicm Date: Fri, 19 Jun 2026 08:21:55 +0000 Subject: [PATCH] Do not dereference the current window if it is NULL (can be if the notification fires after session is destroyed). GitHub issue 5244 from Ben Maurer. --- control-notify.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/control-notify.c b/control-notify.c index 151f959d..021f9884 100644 --- a/control-notify.c +++ b/control-notify.c @@ -224,6 +224,14 @@ control_notify_session_window_changed(struct session *s) { struct client *c; + /* + * A deferred session-window-changed notification can fire after the + * session has been destroyed (which sets curw to NULL) but is kept + * alive by the notification's reference. Skip the notification. + */ + if (s->curw == NULL) + return; + TAILQ_FOREACH(c, &clients, entry) { if (!CONTROL_SHOULD_NOTIFY_CLIENT(c)) continue;