aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFurkan Sahin <furkan-dev@proton.me>2018-04-13 09:19:04 -0400
committerFurkan Sahin <furkan-dev@proton.me>2018-04-13 09:19:04 -0400
commit0c8a894acd28195a238dbbf1f5f2659d3428ba17 (patch)
treeb27acb8f604bf5fc5cc39b927d3e62d748cf7313
parentefab268f3f6a9ed359f9bacd8b3d65a99b12c9a1 (diff)
parentc4754bce7f933f087dd8864260a2371ba21160a2 (diff)
Merge pull request #1804 from martinetd/crashes
Fix crashes
-rw-r--r--sway/input/seat.c3
-rw-r--r--sway/tree/container.c2
2 files changed, 4 insertions, 1 deletions
diff --git a/sway/input/seat.c b/sway/input/seat.c
index 467e5087..431460c4 100644
--- a/sway/input/seat.c
+++ b/sway/input/seat.c
@@ -491,6 +491,9 @@ void seat_set_focus_warp(struct sway_seat *seat,
ipc_event_workspace(last_ws, container, "focus");
if (!workspace_is_visible(last_ws)
&& last_ws->children->length == 0) {
+ if (last_ws == last_focus) {
+ last_focus = NULL;
+ }
container_destroy(last_ws);
}
}
diff --git a/sway/tree/container.c b/sway/tree/container.c
index ea1c93bb..c0067493 100644
--- a/sway/tree/container.c
+++ b/sway/tree/container.c
@@ -104,7 +104,7 @@ static void _container_destroy(struct sway_container *cont) {
if (cont->children != NULL && cont->children->length) {
// remove children until there are no more, container_destroy calls
// container_remove_child, which removes child from this container
- while (cont->children != NULL) {
+ while (cont->children != NULL && cont->children->length > 0) {
struct sway_container *child = cont->children->items[0];
container_remove_child(child);
_container_destroy(child);