aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Ser <contact@emersion.fr>2022-11-10 14:35:14 +0100
committerKirill Primak <vyivel@eclair.cafe>2022-11-10 22:27:38 +0300
commitdcd2076f3854f4bb0018b6a47781dc48a55393b0 (patch)
tree220eb2a4a3861a62b5c1afc9e73216cef9bf7024
parent6c3b35701d70c3ce5fc0ae719739d44b592b4143 (diff)
Use wl_signal_emit_mutable()
This function fixes segfaults when emitting a signal potentially removes arbitrary listeners.
-rw-r--r--meson.build2
-rw-r--r--sway/tree/container.c4
-rw-r--r--sway/tree/output.c6
-rw-r--r--sway/tree/view.c2
-rw-r--r--sway/tree/workspace.c4
5 files changed, 9 insertions, 9 deletions
diff --git a/meson.build b/meson.build
index fccf6429..0a737c36 100644
--- a/meson.build
+++ b/meson.build
@@ -46,7 +46,7 @@ subproject(
jsonc = dependency('json-c', version: '>=0.13')
pcre2 = dependency('libpcre2-8')
-wayland_server = dependency('wayland-server', version: '>=1.20.0')
+wayland_server = dependency('wayland-server', version: '>=1.21.0')
wayland_client = dependency('wayland-client')
wayland_cursor = dependency('wayland-cursor')
wayland_egl = dependency('wayland-egl')
diff --git a/sway/tree/container.c b/sway/tree/container.c
index bf7085cb..718dd0e0 100644
--- a/sway/tree/container.c
+++ b/sway/tree/container.c
@@ -49,7 +49,7 @@ struct sway_container *container_create(struct sway_view *view) {
c->outputs = create_list();
wl_signal_init(&c->events.destroy);
- wl_signal_emit(&root->events.new_node, &c->node);
+ wl_signal_emit_mutable(&root->events.new_node, &c->node);
return c;
}
@@ -104,7 +104,7 @@ void container_begin_destroy(struct sway_container *con) {
container_fullscreen_disable(con);
}
- wl_signal_emit(&con->node.events.destroy, &con->node);
+ wl_signal_emit_mutable(&con->node.events.destroy, &con->node);
container_end_mouse_operation(con);
diff --git a/sway/tree/output.c b/sway/tree/output.c
index b30e646e..368f0541 100644
--- a/sway/tree/output.c
+++ b/sway/tree/output.c
@@ -147,7 +147,7 @@ void output_enable(struct sway_output *output) {
input_manager_configure_xcursor();
- wl_signal_emit(&root->events.new_node, &output->node);
+ wl_signal_emit_mutable(&root->events.new_node, &output->node);
arrange_layers(output);
arrange_root();
@@ -263,7 +263,7 @@ void output_disable(struct sway_output *output) {
}
sway_log(SWAY_DEBUG, "Disabling output '%s'", output->wlr_output->name);
- wl_signal_emit(&output->events.disable, output);
+ wl_signal_emit_mutable(&output->events.disable, output);
output_evacuate(output);
@@ -287,7 +287,7 @@ void output_begin_destroy(struct sway_output *output) {
return;
}
sway_log(SWAY_DEBUG, "Destroying output '%s'", output->wlr_output->name);
- wl_signal_emit(&output->node.events.destroy, &output->node);
+ wl_signal_emit_mutable(&output->node.events.destroy, &output->node);
output->node.destroying = true;
node_set_dirty(&output->node);
diff --git a/sway/tree/view.c b/sway/tree/view.c
index 0004ed14..589a3f7e 100644
--- a/sway/tree/view.c
+++ b/sway/tree/view.c
@@ -847,7 +847,7 @@ void view_map(struct sway_view *view, struct wlr_surface *wlr_surface,
}
void view_unmap(struct sway_view *view) {
- wl_signal_emit(&view->events.unmap, view);
+ wl_signal_emit_mutable(&view->events.unmap, view);
wl_list_remove(&view->surface_new_subsurface.link);
diff --git a/sway/tree/workspace.c b/sway/tree/workspace.c
index c84320bd..0c4e97a3 100644
--- a/sway/tree/workspace.c
+++ b/sway/tree/workspace.c
@@ -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);