server: add a safer signal type and port wl_display to it
authorGiulio Camuffo <giuliocamuffo@gmail.com>
Tue, 24 Jan 2017 14:34:28 +0000 (16:34 +0200)
committerPekka Paalanen <pekka.paalanen@collabora.co.uk>
Wed, 25 Jan 2017 11:46:23 +0000 (13:46 +0200)
commit5e6eb032294ecdee889600c604dfcaab0ffb9398
tree9feb6fc39e33979a93ed4e4aadb6d84b68a61977
parent23d8bc5a64312d4e1e233fd04844cc22a6bb512d
server: add a safer signal type and port wl_display to it

wl_list_for_each_safe, which is used by wl_signal_emit is not really
safe. If a signal has two listeners, and the first one removes and
re-inits the second one, it would enter an infinite loop, which was hit
in weston on resource destruction, which emits a signal.
This commit adds a new version of wl_signal, called wl_priv_signal,
which is private in wayland-server.c and which does not have this problem.
The old wl_signal cannot be improved without breaking backwards compatibility.

Signed-off-by: Giulio Camuffo <giulio.camuffo@kdab.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Makefile.am
src/wayland-private.h
src/wayland-server.c
tests/newsignal-test.c [new file with mode: 0644]