aboutsummaryrefslogtreecommitdiff
path: root/sway/tree/container.c
diff options
context:
space:
mode:
authoremersion <contact@emersion.fr>2018-06-03 09:20:22 +0100
committerGitHub <noreply@github.com>2018-06-03 09:20:22 +0100
commit5c2ae9c60021ace8b5a599671f51935edd18a2ae (patch)
tree75384b8790f6497181cdf00a9b26073809b641d6 /sway/tree/container.c
parentfb932cf8477120ee9fd9db37be1cd26a603fe0a3 (diff)
parent8289e303085845b26e5fcb953facba36bbb99062 (diff)
Merge pull request #2097 from RyanDwyer/fix-workspace-segfault
Fix potential crash when destroying workspace
Diffstat (limited to 'sway/tree/container.c')
-rw-r--r--sway/tree/container.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/sway/tree/container.c b/sway/tree/container.c
index 9e70da09..d0d26631 100644
--- a/sway/tree/container.c
+++ b/sway/tree/container.c
@@ -204,9 +204,17 @@ static struct sway_container *container_workspace_destroy(
}
}
- free(workspace->sway_workspace);
+ struct sway_workspace *sway_workspace = workspace->sway_workspace;
+
+ // This emits the destroy event and also destroys the swayc.
_container_destroy(workspace);
+ // Clean up the floating container
+ sway_workspace->floating->parent = NULL;
+ _container_destroy(sway_workspace->floating);
+
+ free(sway_workspace);
+
if (output) {
output_damage_whole(output->sway_output);
}