about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorMarco Peereboom <marco@conformal.com>2011-10-28 09:41:10 -0500
committerMarco Peereboom <marco@conformal.com>2011-10-28 09:41:10 -0500
commit8cac31f9fd0a12ef776aeae2812517297653b964 (patch)
tree59491dece6dbaa0749bb454caacca2bcf3981c24
parent69d532669f868806810672b61b8b0252952fffd1 (diff)
downloadxombrero-8cac31f9fd0a12ef776aeae2812517297653b964.tar.gz
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 ;-)
-rw-r--r--xxxterm.c28
1 files 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)