diff options
author | Ryan Dwyer <ryandwyer1@gmail.com> | 2018-10-05 16:39:20 +1000 |
---|---|---|
committer | Ryan Dwyer <ryandwyer1@gmail.com> | 2018-10-05 16:39:20 +1000 |
commit | 44b550298ed64043d54b40f98d627908d37a37d2 (patch) | |
tree | 957b38e10118ca079748b12ab64cd88048242f64 | |
parent | Merge pull request #2764 from ianyfan/rm-base64 (diff) | |
download | sway-44b550298ed64043d54b40f98d627908d37a37d2.tar.gz sway-44b550298ed64043d54b40f98d627908d37a37d2.tar.zst sway-44b550298ed64043d54b40f98d627908d37a37d2.zip |
Fix crash when flattening container after moving
container_flatten removes the container from the tree (via
container_replace) before destroying it. When destroying, the recent
changes to handle_seat_node_destroy incorrectly assumes that the
container has a parent.
This adds a check for destroying a container which is no longer in the
tree. If this is the case, focus does not need to be changed.
-rw-r--r-- | sway/input/seat.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/sway/input/seat.c b/sway/input/seat.c index 415f85ac..675edb2d 100644 --- a/sway/input/seat.c +++ b/sway/input/seat.c | |||
@@ -157,6 +157,11 @@ static void handle_seat_node_destroy(struct wl_listener *listener, void *data) { | |||
157 | 157 | ||
158 | seat_node_destroy(seat_node); | 158 | seat_node_destroy(seat_node); |
159 | 159 | ||
160 | if (!parent) { | ||
161 | // Destroying a container that is no longer in the tree | ||
162 | return; | ||
163 | } | ||
164 | |||
160 | // Find new focus_inactive (ie. sibling, or workspace if no siblings left) | 165 | // Find new focus_inactive (ie. sibling, or workspace if no siblings left) |
161 | struct sway_node *next_focus = NULL; | 166 | struct sway_node *next_focus = NULL; |
162 | while (next_focus == NULL) { | 167 | while (next_focus == NULL) { |