From 44b550298ed64043d54b40f98d627908d37a37d2 Mon Sep 17 00:00:00 2001 From: Ryan Dwyer Date: Fri, 5 Oct 2018 16:39:20 +1000 Subject: [PATCH] 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. --- sway/input/seat.c | 5 +++++ 1 file changed, 5 insertions(+) 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) { seat_node_destroy(seat_node); + if (!parent) { + // Destroying a container that is no longer in the tree + return; + } + // Find new focus_inactive (ie. sibling, or workspace if no siblings left) struct sway_node *next_focus = NULL; while (next_focus == NULL) {