From ad825913b436c956f5ab8847eee3031cbe70bbe4 Mon Sep 17 00:00:00 2001 From: Michael Stapelberg Date: Mon, 29 Nov 2010 20:20:44 +0100 Subject: [PATCH] Bugfix: Fix crash when moving a floating Con to a different workspace, add testcase (Thanks EelVex) --- src/con.c | 5 +++++ testcases/t/42-regress-move-floating.t | 19 +++++++++++++++++++ 2 files changed, 24 insertions(+) create mode 100644 testcases/t/42-regress-move-floating.t diff --git a/src/con.c b/src/con.c index ba15279e..ab06cfde 100644 --- a/src/con.c +++ b/src/con.c @@ -415,6 +415,11 @@ void con_toggle_fullscreen(Con *con) { * */ void con_move_to_workspace(Con *con, Con *workspace) { + if (con_is_floating(con)) { + DLOG("Using FLOATINGCON instead\n"); + con = con->parent; + } + /* 1: save the container which is going to be focused after the current * container is moved away */ Con *focus_next = con_next_focused(con); diff --git a/testcases/t/42-regress-move-floating.t b/testcases/t/42-regress-move-floating.t new file mode 100644 index 00000000..2fc14177 --- /dev/null +++ b/testcases/t/42-regress-move-floating.t @@ -0,0 +1,19 @@ +#!perl +# vim:ts=4:sw=4:expandtab +# +# Regression: move a floating window to a different workspace crashes i3 +# +use i3test tests => 1; +use X11::XCB qw(:all); + +my $tmp = get_unused_workspace(); +my $otmp = get_unused_workspace(); +cmd "workspace $tmp"; + +cmd 'open'; +cmd 'mode toggle'; +cmd "move workspace $otmp"; + +my $tree = i3('/tmp/nestedcons')->get_tree->recv; +my @nodes = @{$tree->{nodes}}; +ok(@nodes > 0, 'i3 still lives'); -- 2.39.5