server: introduce wl_signal_emit_mutable
authorSimon Ser <contact@emersion.fr>
Mon, 31 Jan 2022 22:09:26 +0000 (23:09 +0100)
committerSimon Ser <contact@emersion.fr>
Mon, 28 Mar 2022 19:06:16 +0000 (19:06 +0000)
commit962aefda42f7bbfb6d9b64b7b177e232213d8a59
tree39c59be1e5ec8331f6e1a9742879349dee32374e
parent868eb99eb07965f34461693d82c68dba503aec46
server: introduce wl_signal_emit_mutable

wl_signal_emit doesn't handle well situations where a listener removes
another listener. This can happen in practice: wlroots and Weston [1]
both have private helpers to workaround this defect.

wl_signal_emit can't be fixed without breaking the API. Instead,
introduce a new function. Callers need to make sure to always remove
listeners when they are free'd.

[1]: https://gitlab.freedesktop.org/wayland/weston/-/merge_requests/457

Signed-off-by: Simon Ser <contact@emersion.fr>
Signed-off-by: Alexandros Frantzis <alexandros.frantzis@collabora.com>
src/wayland-server-core.h
src/wayland-server.c
tests/signal-test.c