sway

i3-compatible Wayland compositor
git clone https://git.awy.one/sway
Log | Files | Refs | README | LICENSE

commit fe6aea1d02db7e172cafdaac61d612d0de2dc9d0
parent 4bde0eb911062817b9b41e91039b373b1efb0e0e
Author: emersion <contact@emersion.fr>
Date:   Sat, 20 Oct 2018 08:37:48 +0200

Merge pull request #2886 from RyanDwyer/fix-headless-unmap-crash

Fix crash when view unmaps while no outputs connected
Diffstat:
Msway/tree/output.c | 1+
Msway/tree/workspace.c | 14+++++++++++---
2 files changed, 12 insertions(+), 3 deletions(-)

diff --git 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) { } } free(ws_name); + ipc_event_workspace(NULL, ws, "init"); } size_t len = sizeof(output->layers) / sizeof(output->layers[0]); diff --git 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;