aboutsummaryrefslogtreecommitdiffstats
path: root/sway/tree/output.c
diff options
context:
space:
mode:
authorLibravatar Ryan Dwyer <ryandwyer1@gmail.com>2018-10-20 12:34:39 +1000
committerLibravatar Ryan Dwyer <ryandwyer1@gmail.com>2018-10-20 13:07:33 +1000
commited771a6a6e147d667c3791f897ad62e307b260fe (patch)
tree04892c5c4a3002c378439bf0ca160a6dbdc6919b /sway/tree/output.c
parentMerge pull request #2872 from RyanDwyer/cursor-rebase (diff)
downloadsway-ed771a6a6e147d667c3791f897ad62e307b260fe.tar.gz
sway-ed771a6a6e147d667c3791f897ad62e307b260fe.tar.zst
sway-ed771a6a6e147d667c3791f897ad62e307b260fe.zip
Fix crash when view unmaps while no outputs connected
When a view unmaps, we call workspace_consider_destroy. This function assumed the workspace would always have an output, but this is not the case when hotplugged down to zero. The function now handles this and allows itself to be destroyed when there is no output. This means that workspace_begin_destroy must remove the workspace from the root->saved_workspaces list to avoid an eventual dangling pointer, so it does that now. Lastly, when an output is plugged in again and it has to create a new initial workspace for it, we must emit the workspace::init IPC event otherwise swaybar shows no workspaces at all. I guess when you start sway, swaybar is started after the workspace has been created which is why this hasn't been needed earlier.
Diffstat (limited to 'sway/tree/output.c')
-rw-r--r--sway/tree/output.c1
1 files changed, 1 insertions, 0 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]);