summaryrefslogtreecommitdiffstats
path: root/session.c
diff options
context:
space:
mode:
authorThomas Adam <thomas@xteddy.org>2016-10-15 02:01:12 +0100
committerThomas Adam <thomas@xteddy.org>2016-10-15 02:01:12 +0100
commit623e54788e77068779933eb60a042e5a82f32673 (patch)
tree02ce8da6ff4062b9d4c4b9846960f6f9849e0b2b /session.c
parent3d2686a236b4ffee762ada8ebb493d8db91f7375 (diff)
parent3f138dc40c37ddee021b92e5d29676ed96b6cab8 (diff)
Merge branch 'obsd-master'
Diffstat (limited to 'session.c')
-rw-r--r--session.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/session.c b/session.c
index 4a93a5c5..7fac2111 100644
--- a/session.c
+++ b/session.c
@@ -210,6 +210,7 @@ session_destroy(struct session *s)
struct winlink *wl;
log_debug("session %s destroyed", s->name);
+ s->curw = NULL;
RB_REMOVE(sessions, &sessions, s);
notify_session_closed(s);
@@ -384,14 +385,17 @@ int
session_detach(struct session *s, struct winlink *wl)
{
if (s->curw == wl &&
- session_last(s) != 0 && session_previous(s, 0) != 0)
+ session_last(s) != 0 &&
+ session_previous(s, 0) != 0)
session_next(s, 0);
wl->flags &= ~WINLINK_ALERTFLAGS;
notify_window_unlinked(s, wl->window);
winlink_stack_remove(&s->lastw, wl);
winlink_remove(&s->windows, wl);
+
session_group_synchronize_from(s);
+
if (RB_EMPTY(&s->windows)) {
session_destroy(s);
return (1);