From 6a1f6b560ff2e831d2f5156484c3c690800f7c84 Mon Sep 17 00:00:00 2001 From: Timo Sirainen Date: Sun, 9 Dec 2001 14:03:44 +0000 Subject: [PATCH] Still some window closing bugs/crashes. git-svn-id: http://svn.irssi.org/repos/irssi/trunk@2225 dbcabf3a-b0e7-0310-adc4-f8d773084564 --- src/fe-text/mainwindows.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/src/fe-text/mainwindows.c b/src/fe-text/mainwindows.c index 14af4048..60fd3de9 100644 --- a/src/fe-text/mainwindows.c +++ b/src/fe-text/mainwindows.c @@ -129,7 +129,7 @@ static GSList *get_sticky_windows_sorted(MAIN_WINDOW_REC *mainwin) void mainwindow_change_active(MAIN_WINDOW_REC *mainwin, WINDOW_REC *skip_window) { - WINDOW_REC *window; + WINDOW_REC *window, *other; GSList *tmp; mainwin->active = NULL; @@ -149,16 +149,21 @@ void mainwindow_change_active(MAIN_WINDOW_REC *mainwin, } } + other = NULL; for (tmp = windows; tmp != NULL; tmp = tmp->next) { WINDOW_REC *rec = tmp->data; - if (rec != skip_window && WINDOW_MAIN(rec) != mainwin) { - window_set_active(rec); - break; + if (rec != skip_window) { + if (WINDOW_MAIN(rec) == mainwin) { + window_set_active(rec); + return; + } + other = rec; } } - /* no more non-sticky windows, remove main window */ + /* no more non-sticky windows, remove main window */ + window_set_active(other); mainwindow_destroy(mainwin); }