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:
Orestis Floros
2019-10-16 01:14:39 +03:00
parent cb9620c60a
commit 359d75cd3c
3 changed files with 49 additions and 4 deletions

View File

@ -1508,9 +1508,11 @@ void cmd_move_direction(I3_CMD, const char *direction_str, long move_px) {
}
}
/* the move command should not disturb focus */
if (focused != initially_focused)
/* The move command should not disturb focus. con_exists is called because
* tree_move calls tree_flatten. */
if (focused != initially_focused && con_exists(initially_focused)) {
con_activate(initially_focused);
}
// XXX: default reply for now, make this a better reply
ysuccess(true);

View File

@ -237,8 +237,8 @@ static void move_to_output_directed(Con *con, direction_t direction) {
/* force re-painting the indicators */
FREE(con->deco_render_params);
tree_flatten(croot);
ipc_send_window_event("move", con);
tree_flatten(croot);
ewmh_update_wm_desktop();
}
@ -384,7 +384,7 @@ end:
/* force re-painting the indicators */
FREE(con->deco_render_params);
tree_flatten(croot);
ipc_send_window_event("move", con);
tree_flatten(croot);
ewmh_update_wm_desktop();
}