From: Ingo Bürk Date: Wed, 15 Apr 2015 17:59:53 +0000 (+0200) Subject: Disallow moving a container to itself since this would crash i3. X-Git-Tag: 4.11~129^2~3 X-Git-Url: https://git.sur5r.net/?p=i3%2Fi3;a=commitdiff_plain;h=283b2312907e0babcdb443f8b62e0aeb0a7ddd51 Disallow moving a container to itself since this would crash i3. --- diff --git a/src/con.c b/src/con.c index a5304553..b82d056a 100644 --- a/src/con.c +++ b/src/con.c @@ -914,6 +914,11 @@ bool con_move_to_mark(Con *con, const char *mark) { target = TAILQ_FIRST(&(target->focus_head)); } + if (con == target) { + DLOG("cannot move the container to itself, aborting.\n"); + return false; + } + return _con_move_to_con(con, target, false, true, false); } diff --git a/testcases/t/243-move-to-mark.t b/testcases/t/243-move-to-mark.t index f3451675..86d71864 100644 --- a/testcases/t/243-move-to-mark.t +++ b/testcases/t/243-move-to-mark.t @@ -268,6 +268,21 @@ sync_with_i3; ($nodes, $focus) = get_ws_content($target_ws); is(@{$nodes}, 1, 'tiling container moved to the target workspace'); +############################################################################### +# Given 'S' and 'M' are the same container, when 'S' is moved to 'M', then +# the command is ignored. +############################################################################### + +$ws = fresh_workspace; +$S = open_window; +$M = $S; +cmd 'mark target'; + +cmd '[id="' . $S->{id} . '"] move container to mark target'; +sync_with_i3; + +does_i3_live; + ############################################################################### done_testing;