diff options
author | Simon Ser <contact@emersion.fr> | 2022-06-05 09:44:55 +0200 |
---|---|---|
committer | Benjamin Tissoires <benjamin.tissoires@gmail.com> | 2022-06-05 10:36:11 +0000 |
commit | 99f63b03e7970093cf4b8028b21b26b656e14e6f (patch) | |
tree | 5a0cee70e1ebc22f1bff189509cd9671372ee1cf | |
parent | 808e660291309ad36581356cb7a3931657d228af (diff) |
Remove remaining wl_signal_emit calls
Replace them with wlr_signal_emit_safe, which correctly handles
cases where a listener removes another listener.
Reported-by: Isaac Freund <ifreund@ifreund.xyz>
-rw-r--r-- | render/allocator/allocator.c | 3 | ||||
-rw-r--r-- | types/tablet_v2/wlr_tablet_v2_pad.c | 15 | ||||
-rw-r--r-- | types/tablet_v2/wlr_tablet_v2_tool.c | 9 | ||||
-rw-r--r-- | types/wlr_buffer.c | 2 |
4 files changed, 16 insertions, 13 deletions
diff --git a/render/allocator/allocator.c b/render/allocator/allocator.c index 6b96e023..00dadd29 100644 --- a/render/allocator/allocator.c +++ b/render/allocator/allocator.c @@ -14,6 +14,7 @@ #include "render/allocator/drm_dumb.h" #include "render/allocator/shm.h" #include "render/wlr_renderer.h" +#include "util/signal.h" #if WLR_HAS_GBM_ALLOCATOR #include "render/allocator/gbm.h" @@ -158,7 +159,7 @@ void wlr_allocator_destroy(struct wlr_allocator *alloc) { if (alloc == NULL) { return; } - wl_signal_emit(&alloc->events.destroy, NULL); + wlr_signal_emit_safe(&alloc->events.destroy, NULL); alloc->impl->destroy(alloc); } diff --git a/types/tablet_v2/wlr_tablet_v2_pad.c b/types/tablet_v2/wlr_tablet_v2_pad.c index 58094f57..a468a124 100644 --- a/types/tablet_v2/wlr_tablet_v2_pad.c +++ b/types/tablet_v2/wlr_tablet_v2_pad.c @@ -2,7 +2,6 @@ #define _POSIX_C_SOURCE 200809L #endif -#include "tablet-unstable-v2-protocol.h" #include <assert.h> #include <stdlib.h> #include <types/wlr_tablet_v2.h> @@ -12,6 +11,8 @@ #include <wlr/types/wlr_tablet_pad.h> #include <wlr/types/wlr_tablet_v2.h> #include <wlr/util/log.h> +#include "util/signal.h" +#include "tablet-unstable-v2-protocol.h" static const struct wlr_tablet_pad_v2_grab_interface default_pad_grab_interface; @@ -49,9 +50,9 @@ static void handle_tablet_pad_ring_v2_set_feedback(struct wl_client *client, .serial = serial, .description = description, .index = aux->index - }; + }; - wl_signal_emit(&aux->pad->pad->events.ring_feedback, &evt); + wlr_signal_emit_safe(&aux->pad->pad->events.ring_feedback, &evt); } static void handle_tablet_pad_ring_v2_destroy(struct wl_client *client, @@ -87,9 +88,9 @@ static void handle_tablet_pad_strip_v2_set_feedback(struct wl_client *client, .serial = serial, .description = description, .index = aux->index - }; + }; - wl_signal_emit(&aux->pad->pad->events.strip_feedback, &evt); + wlr_signal_emit_safe(&aux->pad->pad->events.strip_feedback, &evt); } static void handle_tablet_pad_strip_v2_destroy(struct wl_client *client, @@ -114,9 +115,9 @@ static void handle_tablet_pad_v2_set_feedback( struct wl_client *client, .serial = serial, .index = button, .description = description, - }; + }; - wl_signal_emit(&pad->pad->events.button_feedback, &evt); + wlr_signal_emit_safe(&pad->pad->events.button_feedback, &evt); } static const struct zwp_tablet_pad_v2_interface tablet_pad_impl = { diff --git a/types/tablet_v2/wlr_tablet_v2_tool.c b/types/tablet_v2/wlr_tablet_v2_tool.c index 9e5b9658..e47e9103 100644 --- a/types/tablet_v2/wlr_tablet_v2_tool.c +++ b/types/tablet_v2/wlr_tablet_v2_tool.c @@ -2,9 +2,6 @@ #define _POSIX_C_SOURCE 200809L #endif -#include "tablet-unstable-v2-protocol.h" -#include "util/array.h" -#include "util/time.h" #include <assert.h> #include <stdlib.h> #include <types/wlr_tablet_v2.h> @@ -13,6 +10,10 @@ #include <wlr/types/wlr_tablet_tool.h> #include <wlr/types/wlr_tablet_v2.h> #include <wlr/util/log.h> +#include "util/array.h" +#include "util/signal.h" +#include "util/time.h" +#include "tablet-unstable-v2-protocol.h" static const struct wlr_tablet_tool_v2_grab_interface default_tool_grab_interface; @@ -46,7 +47,7 @@ static void handle_tablet_tool_v2_set_cursor(struct wl_client *client, .seat_client = tool->seat->seat_client, }; - wl_signal_emit(&tool->tool->events.set_cursor, &evt); + wlr_signal_emit_safe(&tool->tool->events.set_cursor, &evt); } static void handle_tablet_tool_v2_destroy(struct wl_client *client, diff --git a/types/wlr_buffer.c b/types/wlr_buffer.c index e50fad40..96e508b2 100644 --- a/types/wlr_buffer.c +++ b/types/wlr_buffer.c @@ -64,7 +64,7 @@ void wlr_buffer_unlock(struct wlr_buffer *buffer) { buffer->n_locks--; if (buffer->n_locks == 0) { - wl_signal_emit(&buffer->events.release, NULL); + wlr_signal_emit_safe(&buffer->events.release, NULL); } buffer_consider_destroy(buffer); |