diff options
author | Nicholas Marriott <nicholas.marriott@gmail.com> | 2007-09-21 18:31:58 +0000 |
---|---|---|
committer | Nicholas Marriott <nicholas.marriott@gmail.com> | 2007-09-21 18:31:58 +0000 |
commit | 248f78d29a705df9c5faa67c8ca0394fd028448a (patch) | |
tree | f033a91bb041a1568102d0b28ff689487ee7c7fd /session.c | |
parent | 33f5f84f995fb27a9a5d95723369eca2c90a8ec5 (diff) | |
download | rtmux-248f78d29a705df9c5faa67c8ca0394fd028448a.tar.gz rtmux-248f78d29a705df9c5faa67c8ca0394fd028448a.tar.bz2 rtmux-248f78d29a705df9c5faa67c8ca0394fd028448a.zip |
Remove window before working out new current window; clear last window if necessary.
Diffstat (limited to 'session.c')
-rw-r--r-- | session.c | 11 |
1 files changed, 5 insertions, 6 deletions
@@ -1,4 +1,4 @@ -/* $Id: session.c,v 1.10 2007-09-21 18:16:31 nicm Exp $ */ +/* $Id: session.c,v 1.11 2007-09-21 18:31:58 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> @@ -129,14 +129,13 @@ session_attach(struct session *s, struct window *w) int session_detach(struct session *s, struct window *w) { - /* Move to last, previous of next window if possible. */ + window_remove(&s->windows, w); + + if (s->last == w) + s->last = NULL; if (s->window == w && session_last(s) != 0 && session_previous(s) != 0) session_next(s); - /* Remove the window from the list. */ - window_remove(&s->windows, w); - - /* Destroy session if it is empty. */ if (!ARRAY_EMPTY(&s->windows)) return (0); session_destroy(s); |