summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLibravatar emersion <contact@emersion.fr>2018-10-20 08:37:48 +0200
committerLibravatar GitHub <noreply@github.com>2018-10-20 08:37:48 +0200
commitfe6aea1d02db7e172cafdaac61d612d0de2dc9d0 (patch)
tree426f440e205997a26eb415c67d7558efe56cc269
parentMerge pull request #2879 from Emantor/fix/swaybar_position (diff)
parentFix crash when view unmaps while no outputs connected (diff)
downloadsway-fe6aea1d02db7e172cafdaac61d612d0de2dc9d0.tar.gz
sway-fe6aea1d02db7e172cafdaac61d612d0de2dc9d0.tar.zst
sway-fe6aea1d02db7e172cafdaac61d612d0de2dc9d0.zip
Merge pull request #2886 from RyanDwyer/fix-headless-unmap-crash
Fix crash when view unmaps while no outputs connected
-rw-r--r--sway/tree/output.c1
-rw-r--r--sway/tree/workspace.c14
2 files changed, 12 insertions, 3 deletions
diff --git a/sway/tree/output.c b/sway/tree/output.c
index c3176325..98041c47 100644
--- a/sway/tree/output.c
+++ b/sway/tree/output.c
@@ -89,6 +89,7 @@ void output_enable(struct sway_output *output, struct output_config *oc) {
89 } 89 }
90 } 90 }
91 free(ws_name); 91 free(ws_name);
92 ipc_event_workspace(NULL, ws, "init");
92 } 93 }
93 94
94 size_t len = sizeof(output->layers) / sizeof(output->layers[0]); 95 size_t len = sizeof(output->layers) / sizeof(output->layers[0]);
diff --git a/sway/tree/workspace.c b/sway/tree/workspace.c
index 2a00824d..ed875ebb 100644
--- a/sway/tree/workspace.c
+++ b/sway/tree/workspace.c
@@ -119,6 +119,11 @@ void workspace_begin_destroy(struct sway_workspace *workspace) {
119 119
120 if (workspace->output) { 120 if (workspace->output) {
121 workspace_detach(workspace); 121 workspace_detach(workspace);
122 } else {
123 int index = list_find(root->saved_workspaces, workspace);
124 if (index != -1) {
125 list_del(root->saved_workspaces, index);
126 }
122 } 127 }
123 128
124 workspace->node.destroying = true; 129 workspace->node.destroying = true;
@@ -126,10 +131,13 @@ void workspace_begin_destroy(struct sway_workspace *workspace) {
126} 131}
127 132
128void workspace_consider_destroy(struct sway_workspace *ws) { 133void workspace_consider_destroy(struct sway_workspace *ws) {
129 if (ws->tiling->length == 0 && ws->floating->length == 0 134 if (ws->tiling->length || ws->floating->length) {
130 && output_get_active_workspace(ws->output) != ws) { 135 return;
131 workspace_begin_destroy(ws); 136 }
137 if (ws->output && output_get_active_workspace(ws->output) == ws) {
138 return;
132 } 139 }
140 workspace_begin_destroy(ws);
133} 141}
134 142
135char *prev_workspace_name = NULL; 143char *prev_workspace_name = NULL;