aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLibravatar emersion <contact@emersion.fr>2018-04-13 09:19:04 -0400
committerLibravatar GitHub <noreply@github.com>2018-04-13 09:19:04 -0400
commit3dd185ec04bd3e4e1e34799adc4d7c28e4ab880c (patch)
treeb27acb8f604bf5fc5cc39b927d3e62d748cf7313
parentMerge pull request #1808 from emersion/xwayland-unmapped-on-create (diff)
parentMerge branch 'master' into crashes (diff)
downloadsway-3dd185ec04bd3e4e1e34799adc4d7c28e4ab880c.tar.gz
sway-3dd185ec04bd3e4e1e34799adc4d7c28e4ab880c.tar.zst
sway-3dd185ec04bd3e4e1e34799adc4d7c28e4ab880c.zip
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,
491 ipc_event_workspace(last_ws, container, "focus"); 491 ipc_event_workspace(last_ws, container, "focus");
492 if (!workspace_is_visible(last_ws) 492 if (!workspace_is_visible(last_ws)
493 && last_ws->children->length == 0) { 493 && last_ws->children->length == 0) {
494 if (last_ws == last_focus) {
495 last_focus = NULL;
496 }
494 container_destroy(last_ws); 497 container_destroy(last_ws);
495 } 498 }
496 } 499 }
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) {
104 if (cont->children != NULL && cont->children->length) { 104 if (cont->children != NULL && cont->children->length) {
105 // remove children until there are no more, container_destroy calls 105 // remove children until there are no more, container_destroy calls
106 // container_remove_child, which removes child from this container 106 // container_remove_child, which removes child from this container
107 while (cont->children != NULL) { 107 while (cont->children != NULL && cont->children->length > 0) {
108 struct sway_container *child = cont->children->items[0]; 108 struct sway_container *child = cont->children->items[0];
109 container_remove_child(child); 109 container_remove_child(child);
110 _container_destroy(child); 110 _container_destroy(child);