i3 - improved tiling WM


Bugfix: resize window check should check for null

Patch status: merged

Patch by Tony Crisci

Long description:

When checking the window type for a resize command, first check to see
if the window property is null before checking whether or not it is a
dock window. The window may be null in the case it is a branch
container.

fixes #1220

To apply this patch, use:
curl http://cr.i3wm.org/patch/505/raw.patch | git am

b/src/commands.c

21
@@ -782,7 +782,7 @@ void cmd_resize(I3_CMD, char *way, char *direction, char *resize_px, char *resiz
22
     owindow *current;
23
     TAILQ_FOREACH(current, &owindows, owindows) {
24
         /* Don't handle dock windows (issue #1201) */
25
-        if (current->con->window->dock) {
26
+        if (current->con->window && current->con->window->dock) {
27
             DLOG("This is a dock window. Not resizing (con = %p)\n)", current->con);
28
             continue;
29
         }

b/testcases/t/224-regress-resize-branch.t

35
@@ -0,0 +1,33 @@
36
+#!perl
37
+# vim:ts=4:sw=4:expandtab
38
+#
39
+# Please read the following documents before working on tests:
40
+# • http://build.i3wm.org/docs/testsuite.html
41
+#   (or docs/testsuite)
42
+#
43
+# • http://build.i3wm.org/docs/lib-i3test.html
44
+#   (alternatively: perldoc ./testcases/lib/i3test.pm)
45
+#
46
+# • http://build.i3wm.org/docs/ipc.html
47
+#   (or docs/ipc)
48
+#
49
+# • http://onyxneon.com/books/modern_perl/modern_perl_a4.pdf
50
+#   (unless you are already familiar with Perl)
51
+#
52
+# Test that i3 does not crash when resizing a split container
53
+# Ticket: #1220
54
+# Bug still in: 4.7.2-128-g702906d
55
+use i3test;
56
+
57
+open_window;
58
+open_window;
59
+
60
+cmd 'split h';
61
+
62
+open_window;
63
+
64
+cmd 'focus parent, resize grow left';
65
+
66
+does_i3_live;
67
+
68
+done_testing;