From 8cac31f9fd0a12ef776aeae2812517297653b964 Mon Sep 17 00:00:00 2001 From: Marco Peereboom Date: Fri, 28 Oct 2011 09:41:10 -0500 Subject: Fix crash during session open. This was an out of order race between deleting old tabs and creating new ones. So delete old tabs first before opening the new ones. Found by MALLOC_OPTIONS=S and I am sure jy-p has run into this. Never ignore bus errors from now on ;-) --- xxxterm.c | 28 +++++++++++++--------------- 1 file changed, 13 insertions(+), 15 deletions(-) diff --git a/xxxterm.c b/xxxterm.c index 5d3ea81..2560a85 100644 --- a/xxxterm.c +++ b/xxxterm.c @@ -2622,6 +2622,19 @@ open_tabs(struct tab *t, struct karg *a) goto done; ti = TAILQ_LAST(&tabs, tab_list); + /* close open tabs */ + if (a->i == XT_SES_CLOSETABS && ti != NULL) { + for (;;) { + tt = TAILQ_FIRST(&tabs); + if (tt != ti) { + delete_tab(tt); + continue; + } + delete_tab(tt); + break; + } + recalc_tabs(); + } for (;;) { if ((uri = fparseln(f, NULL, NULL, "\0\0\0", 0)) == NULL) @@ -2642,21 +2655,6 @@ open_tabs(struct tab *t, struct karg *a) free(uri); uri = NULL; } - - /* close open tabs */ - if (a->i == XT_SES_CLOSETABS && ti != NULL) { - for (;;) { - tt = TAILQ_FIRST(&tabs); - if (tt != ti) { - delete_tab(tt); - continue; - } - delete_tab(tt); - break; - } - recalc_tabs(); - } - rv = 0; done: if (f) -- cgit 1.4.1-2-gfad0