aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLibravatar Simon Ser <contact@emersion.fr>2022-11-10 14:35:14 +0100
committerLibravatar Kirill Primak <vyivel@eclair.cafe>2022-11-10 22:27:38 +0300
commitdcd2076f3854f4bb0018b6a47781dc48a55393b0 (patch)
tree220eb2a4a3861a62b5c1afc9e73216cef9bf7024
parentci: install hwdata (diff)
downloadsway-dcd2076f3854f4bb0018b6a47781dc48a55393b0.tar.gz
sway-dcd2076f3854f4bb0018b6a47781dc48a55393b0.tar.zst
sway-dcd2076f3854f4bb0018b6a47781dc48a55393b0.zip
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(
46 46
47jsonc = dependency('json-c', version: '>=0.13') 47jsonc = dependency('json-c', version: '>=0.13')
48pcre2 = dependency('libpcre2-8') 48pcre2 = dependency('libpcre2-8')
49wayland_server = dependency('wayland-server', version: '>=1.20.0') 49wayland_server = dependency('wayland-server', version: '>=1.21.0')
50wayland_client = dependency('wayland-client') 50wayland_client = dependency('wayland-client')
51wayland_cursor = dependency('wayland-cursor') 51wayland_cursor = dependency('wayland-cursor')
52wayland_egl = dependency('wayland-egl') 52wayland_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) {
49 c->outputs = create_list(); 49 c->outputs = create_list();
50 50
51 wl_signal_init(&c->events.destroy); 51 wl_signal_init(&c->events.destroy);
52 wl_signal_emit(&root->events.new_node, &c->node); 52 wl_signal_emit_mutable(&root->events.new_node, &c->node);
53 53
54 return c; 54 return c;
55} 55}
@@ -104,7 +104,7 @@ void container_begin_destroy(struct sway_container *con) {
104 container_fullscreen_disable(con); 104 container_fullscreen_disable(con);
105 } 105 }
106 106
107 wl_signal_emit(&con->node.events.destroy, &con->node); 107 wl_signal_emit_mutable(&con->node.events.destroy, &con->node);
108 108
109 container_end_mouse_operation(con); 109 container_end_mouse_operation(con);
110 110
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) {
147 147
148 input_manager_configure_xcursor(); 148 input_manager_configure_xcursor();
149 149
150 wl_signal_emit(&root->events.new_node, &output->node); 150 wl_signal_emit_mutable(&root->events.new_node, &output->node);
151 151
152 arrange_layers(output); 152 arrange_layers(output);
153 arrange_root(); 153 arrange_root();
@@ -263,7 +263,7 @@ void output_disable(struct sway_output *output) {
263 } 263 }
264 264
265 sway_log(SWAY_DEBUG, "Disabling output '%s'", output->wlr_output->name); 265 sway_log(SWAY_DEBUG, "Disabling output '%s'", output->wlr_output->name);
266 wl_signal_emit(&output->events.disable, output); 266 wl_signal_emit_mutable(&output->events.disable, output);
267 267
268 output_evacuate(output); 268 output_evacuate(output);
269 269
@@ -287,7 +287,7 @@ void output_begin_destroy(struct sway_output *output) {
287 return; 287 return;
288 } 288 }
289 sway_log(SWAY_DEBUG, "Destroying output '%s'", output->wlr_output->name); 289 sway_log(SWAY_DEBUG, "Destroying output '%s'", output->wlr_output->name);
290 wl_signal_emit(&output->node.events.destroy, &output->node); 290 wl_signal_emit_mutable(&output->node.events.destroy, &output->node);
291 291
292 output->node.destroying = true; 292 output->node.destroying = true;
293 node_set_dirty(&output->node); 293 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,
847} 847}
848 848
849void view_unmap(struct sway_view *view) { 849void view_unmap(struct sway_view *view) {
850 wl_signal_emit(&view->events.unmap, view); 850 wl_signal_emit_mutable(&view->events.unmap, view);
851 851
852 wl_list_remove(&view->surface_new_subsurface.link); 852 wl_list_remove(&view->surface_new_subsurface.link);
853 853
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,
114 output_sort_workspaces(output); 114 output_sort_workspaces(output);
115 115
116 ipc_event_workspace(NULL, ws, "init"); 116 ipc_event_workspace(NULL, ws, "init");
117 wl_signal_emit(&root->events.new_node, &ws->node); 117 wl_signal_emit_mutable(&root->events.new_node, &ws->node);
118 118
119 return ws; 119 return ws;
120} 120}
@@ -142,7 +142,7 @@ void workspace_destroy(struct sway_workspace *workspace) {
142void workspace_begin_destroy(struct sway_workspace *workspace) { 142void workspace_begin_destroy(struct sway_workspace *workspace) {
143 sway_log(SWAY_DEBUG, "Destroying workspace '%s'", workspace->name); 143 sway_log(SWAY_DEBUG, "Destroying workspace '%s'", workspace->name);
144 ipc_event_workspace(NULL, workspace, "empty"); // intentional 144 ipc_event_workspace(NULL, workspace, "empty"); // intentional
145 wl_signal_emit(&workspace->node.events.destroy, &workspace->node); 145 wl_signal_emit_mutable(&workspace->node.events.destroy, &workspace->node);
146 146
147 if (workspace->output) { 147 if (workspace->output) {
148 workspace_detach(workspace); 148 workspace_detach(workspace);