Use wl_signal_emit_mutable()

This function fixes segfaults when emitting a signal potentially
removes arbitrary listeners.
This commit is contained in:
Simon Ser 2022-11-10 14:35:14 +01:00 committed by Kirill Primak
parent 6c3b35701d
commit dcd2076f38
5 changed files with 9 additions and 9 deletions

View file

@ -114,7 +114,7 @@ struct sway_workspace *workspace_create(struct sway_output *output,
output_sort_workspaces(output);
ipc_event_workspace(NULL, ws, "init");
wl_signal_emit(&root->events.new_node, &ws->node);
wl_signal_emit_mutable(&root->events.new_node, &ws->node);
return ws;
}
@ -142,7 +142,7 @@ void workspace_destroy(struct sway_workspace *workspace) {
void workspace_begin_destroy(struct sway_workspace *workspace) {
sway_log(SWAY_DEBUG, "Destroying workspace '%s'", workspace->name);
ipc_event_workspace(NULL, workspace, "empty"); // intentional
wl_signal_emit(&workspace->node.events.destroy, &workspace->node);
wl_signal_emit_mutable(&workspace->node.events.destroy, &workspace->node);
if (workspace->output) {
workspace_detach(workspace);