Merge pull request #2365 from RyanDwyer/fix-cmd-defer-crash

Fix crash when a deferred command destroys a workspace
This commit is contained in:
Drew DeVault 2018-07-28 09:05:04 -04:00 committed by GitHub
commit 68d6307aa6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -142,8 +142,6 @@ struct sway_container *container_create(enum sway_container_type type) {
static void container_workspace_free(struct sway_workspace *ws) { static void container_workspace_free(struct sway_workspace *ws) {
list_foreach(ws->output_priority, free); list_foreach(ws->output_priority, free);
list_free(ws->output_priority); list_free(ws->output_priority);
ws->floating->destroying = true;
container_free(ws->floating);
free(ws); free(ws);
} }
@ -196,6 +194,9 @@ void container_free(struct sway_container *cont) {
free(cont); free(cont);
} }
static struct sway_container *container_destroy_noreaping(
struct sway_container *con);
static struct sway_container *container_workspace_destroy( static struct sway_container *container_workspace_destroy(
struct sway_container *workspace) { struct sway_container *workspace) {
if (!sway_assert(workspace, "cannot destroy null workspace")) { if (!sway_assert(workspace, "cannot destroy null workspace")) {
@ -240,6 +241,8 @@ static struct sway_container *container_workspace_destroy(
} }
} }
container_destroy_noreaping(workspace->sway_workspace->floating);
return output; return output;
} }