Merge pull request #1804 from martinetd/crashes

Fix crashes
This commit is contained in:
emersion 2018-04-13 09:19:04 -04:00 committed by GitHub
commit 3dd185ec04
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 1 deletions

View File

@ -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);
}
}

View File

@ -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);