summaryrefslogtreecommitdiff
path: root/sway/tree/workspace.c
diff options
context:
space:
mode:
authoremersion <[email protected]>2018-10-20 08:37:48 +0200
committerGitHub <[email protected]>2018-10-20 08:37:48 +0200
commitfe6aea1d02db7e172cafdaac61d612d0de2dc9d0 (patch)
tree426f440e205997a26eb415c67d7558efe56cc269 /sway/tree/workspace.c
parent4bde0eb911062817b9b41e91039b373b1efb0e0e (diff)
parented771a6a6e147d667c3791f897ad62e307b260fe (diff)
Merge pull request #2886 from RyanDwyer/fix-headless-unmap-crash
Fix crash when view unmaps while no outputs connected
Diffstat (limited to 'sway/tree/workspace.c')
-rw-r--r--sway/tree/workspace.c14
1 files changed, 11 insertions, 3 deletions
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) {
if (workspace->output) {
workspace_detach(workspace);
+ } else {
+ int index = list_find(root->saved_workspaces, workspace);
+ if (index != -1) {
+ list_del(root->saved_workspaces, index);
+ }
}
workspace->node.destroying = true;
@@ -126,10 +131,13 @@ void workspace_begin_destroy(struct sway_workspace *workspace) {
}
void workspace_consider_destroy(struct sway_workspace *ws) {
- if (ws->tiling->length == 0 && ws->floating->length == 0
- && output_get_active_workspace(ws->output) != ws) {
- workspace_begin_destroy(ws);
+ if (ws->tiling->length || ws->floating->length) {
+ return;
+ }
+ if (ws->output && output_get_active_workspace(ws->output) == ws) {
+ return;
}
+ workspace_begin_destroy(ws);
}
char *prev_workspace_name = NULL;