From c8c83250926c72100d099b1fa360a728a3c9e27c Mon Sep 17 00:00:00 2001 From: Jonas Fonseca Date: Mon, 14 Aug 2006 16:10:24 +0200 Subject: [PATCH] Fix assertion failure related to closing all tabs but the current Decrement term->current_tab before calling delete_window() instead of after deleting all backgrounded tabs, so get_tab_by_number() will see a consistent value. --- src/terminal/tab.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/terminal/tab.c b/src/terminal/tab.c index 7b021d0f..e6825b55 100644 --- a/src/terminal/tab.c +++ b/src/terminal/tab.c @@ -223,11 +223,17 @@ really_close_tabs(struct session *ses) foreach_tab (tab, term->windows) { if (tab == current) continue; + + /* Update the current tab counter so assertions in the + * delete_window() call-chain will hold, namely the one in + * get_tab_by_number(). */ + if (term->current_tab > 0) + term->current_tab--; + tab = tab->prev; delete_window(tab->next); } - term->current_tab = 0; redraw_terminal(term); }