Fix crash with moving container that is to be flattened
Same can happen with move_to_output_directed but it is not so easy to write a test about it. Fixes #3831
This commit is contained in:
parent
cb9620c60a
commit
359d75cd3c
|
@ -1508,9 +1508,11 @@ void cmd_move_direction(I3_CMD, const char *direction_str, long move_px) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* the move command should not disturb focus */
|
/* The move command should not disturb focus. con_exists is called because
|
||||||
if (focused != initially_focused)
|
* tree_move calls tree_flatten. */
|
||||||
|
if (focused != initially_focused && con_exists(initially_focused)) {
|
||||||
con_activate(initially_focused);
|
con_activate(initially_focused);
|
||||||
|
}
|
||||||
|
|
||||||
// XXX: default reply for now, make this a better reply
|
// XXX: default reply for now, make this a better reply
|
||||||
ysuccess(true);
|
ysuccess(true);
|
||||||
|
|
|
@ -237,8 +237,8 @@ static void move_to_output_directed(Con *con, direction_t direction) {
|
||||||
/* force re-painting the indicators */
|
/* force re-painting the indicators */
|
||||||
FREE(con->deco_render_params);
|
FREE(con->deco_render_params);
|
||||||
|
|
||||||
tree_flatten(croot);
|
|
||||||
ipc_send_window_event("move", con);
|
ipc_send_window_event("move", con);
|
||||||
|
tree_flatten(croot);
|
||||||
ewmh_update_wm_desktop();
|
ewmh_update_wm_desktop();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -384,7 +384,7 @@ end:
|
||||||
/* force re-painting the indicators */
|
/* force re-painting the indicators */
|
||||||
FREE(con->deco_render_params);
|
FREE(con->deco_render_params);
|
||||||
|
|
||||||
tree_flatten(croot);
|
|
||||||
ipc_send_window_event("move", con);
|
ipc_send_window_event("move", con);
|
||||||
|
tree_flatten(croot);
|
||||||
ewmh_update_wm_desktop();
|
ewmh_update_wm_desktop();
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,43 @@
|
||||||
|
#!perl
|
||||||
|
# vim:ts=4:sw=4:expandtab
|
||||||
|
#
|
||||||
|
# Please read the following documents before working on tests:
|
||||||
|
# • https://build.i3wm.org/docs/testsuite.html
|
||||||
|
# (or docs/testsuite)
|
||||||
|
#
|
||||||
|
# • https://build.i3wm.org/docs/lib-i3test.html
|
||||||
|
# (alternatively: perldoc ./testcases/lib/i3test.pm)
|
||||||
|
#
|
||||||
|
# • https://build.i3wm.org/docs/ipc.html
|
||||||
|
# (or docs/ipc)
|
||||||
|
#
|
||||||
|
# • http://onyxneon.com/books/modern_perl/modern_perl_a4.pdf
|
||||||
|
# (unless you are already familiar with Perl)
|
||||||
|
#
|
||||||
|
# Test that moving a container that is to be flattened does not crash i3
|
||||||
|
# Ticket: #3831
|
||||||
|
# Bug still in: 4.17-199-ga638e0408
|
||||||
|
use i3test;
|
||||||
|
|
||||||
|
cmp_tree(
|
||||||
|
msg => 'Moving a redundant container that is to be flattened does not crash i3',
|
||||||
|
layout_before => 'a H[V[b* c]]', # Not very attached to this result but
|
||||||
|
layout_after => 'H[a] b* c', # mainly checking if the crash happens.
|
||||||
|
cb => sub {
|
||||||
|
cmd 'focus parent, focus parent, move down';
|
||||||
|
does_i3_live;
|
||||||
|
is(get_ws(focused_ws)->{layout}, 'splitv', 'Workspace changed to splitv');
|
||||||
|
});
|
||||||
|
|
||||||
|
cmp_tree(
|
||||||
|
msg => "Same but create the redundant container with a 'split h' command",
|
||||||
|
layout_before => 'a V[b* c]',
|
||||||
|
layout_after => 'H[a] b* c',
|
||||||
|
cb => sub {
|
||||||
|
cmd 'focus parent, split h, focus parent, move down';
|
||||||
|
does_i3_live;
|
||||||
|
is(get_ws(focused_ws)->{layout}, 'splitv', 'Workspace changed to splitv');
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
done_testing;
|
Loading…
Reference in New Issue