From b595ff05c534639afa63900cdd16bc4902ee2a12 Mon Sep 17 00:00:00 2001 From: Michael Stapelberg Date: Mon, 28 Feb 2011 20:44:23 +0100 Subject: [PATCH] =?utf8?q?Fix=20regression:=20Don=E2=80=99t=20add=20floati?= =?utf8?q?ng=20nodes=20twice=20when=20restoring=20layout=20(+testcase)?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- src/load_layout.c | 6 +++--- testcases/t/43-regress-floating-restart.t | 24 +++++++++++++++++++++++ 2 files changed, 27 insertions(+), 3 deletions(-) create mode 100644 testcases/t/43-regress-floating-restart.t diff --git a/src/load_layout.c b/src/load_layout.c index 72b23d9f..92cfecbd 100644 --- a/src/load_layout.c +++ b/src/load_layout.c @@ -22,18 +22,18 @@ struct Match *current_swallow; static int json_start_map(void *ctx) { LOG("start of map, last_key = %s\n", last_key); if (parsing_swallows) { - LOG("TODO: create new swallow\n"); + LOG("creating new swallow\n"); current_swallow = smalloc(sizeof(Match)); match_init(current_swallow); TAILQ_INSERT_TAIL(&(json_node->swallow_head), current_swallow, matches); } else { if (!parsing_rect && !parsing_window_rect && !parsing_geometry) { if (last_key && strcasecmp(last_key, "floating_nodes") == 0) { + DLOG("New floating_node\n"); Con *ws = con_get_workspace(json_node); json_node = con_new(NULL); json_node->parent = ws; - TAILQ_INSERT_TAIL(&(ws->floating_head), json_node, floating_windows); - TAILQ_INSERT_TAIL(&(ws->focus_head), json_node, focused); + DLOG("Parent is workspace = %p\n", ws); } else { Con *parent = json_node; json_node = con_new(NULL); diff --git a/testcases/t/43-regress-floating-restart.t b/testcases/t/43-regress-floating-restart.t new file mode 100644 index 00000000..974c1ae1 --- /dev/null +++ b/testcases/t/43-regress-floating-restart.t @@ -0,0 +1,24 @@ +#!perl +# vim:ts=4:sw=4:expandtab +# +# Regression: floating windows are tiling after restarting, closing them crashes i3 +# +use i3test tests => 1; +use Time::HiRes qw(sleep); +use X11::XCB qw(:all); + +my $tmp = get_unused_workspace(); +cmd "workspace $tmp"; + +cmd 'open'; +cmd 'mode toggle'; +cmd 'restart'; + +sleep 0.5; + +diag('Checking if i3 still lives'); + +does_i3_live; + +my $ws = get_ws($tmp); +diag('ws = ' . Dumper($ws)); -- 2.39.5