diff --git a/server-fn.c b/server-fn.c index ce5e518d..3c7277bd 100644 --- a/server-fn.c +++ b/server-fn.c @@ -260,13 +260,13 @@ server_kill_window(struct window *w) s = ARRAY_ITEM(&sessions, i); if (s == NULL || !session_has(s, w)) continue; - if ((wl = winlink_find_by_window(&s->windows, w)) == NULL) - continue; - - if (session_detach(s, wl)) - server_destroy_session_group(s); - else - server_redraw_session_group(s); + while ((wl = winlink_find_by_window(&s->windows, w)) != NULL) { + if (session_detach(s, wl)) { + server_destroy_session_group(s); + break; + } else + server_redraw_session_group(s); + } } }