Package: tmux / 1.9-6~bpo70+1

upstream-78e783e786.diff Patch series | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
commit 78e783e7863eb33981da4a5ad48dd9e2aa2b08dd
Author: Nicholas Marriott <nicholas.marriott@gmail.com>
Date:   Thu Mar 6 13:01:51 2014 +0000

    Don't segfaut when the parent of the layout cell is NULL, from Thomas Adam.

diff --git a/window.c b/window.c
index 1dd70c4..9a26b90 100644
--- a/window.c
+++ b/window.c
@@ -420,10 +420,15 @@ window_pane_active_set(struct window_pane *wp, struct window_pane *nextwp)
 void
 window_pane_active_lost(struct window_pane *wp, struct window_pane *nextwp)
 {
-	struct layout_cell	*lc, *lc2;
+	struct layout_cell	*lc, *lc2, *lcparent;
+
+	/* Get the parent cell. */
+	lcparent = nextwp->layout_cell->parent;
+	if (lcparent == NULL)
+		return;
 
 	/* Save the target pane in its parent. */
-	nextwp->layout_cell->parent->lastwp = nextwp;
+	lcparent->lastwp = nextwp;
 
 	/*
 	 * Save the source pane in all of its parents up to, but not including,
@@ -432,8 +437,7 @@ window_pane_active_lost(struct window_pane *wp, struct window_pane *nextwp)
 	if (wp == NULL)
 		return;
 	for (lc = wp->layout_cell->parent; lc != NULL; lc = lc->parent) {
-		lc2 = nextwp->layout_cell->parent;
-		for (; lc2 != NULL; lc2 = lc2->parent) {
+		for (lc2 = lcparent; lc2 != NULL; lc2 = lc2->parent) {
 			if (lc == lc2)
 				return;
 		}