From: Markus Ongyerth <>

In [1] it was pointed out, that the proposed patch breaks code, that does not
remove their listener from a wl_signal list, but just free()s them.

From libwayland's perspective, this has never been different. People just got
wl_priv_signal_emit will touch the recently free()d memory again IFF there is
another listener behind it in the signal list.
The attached patch makes this obvious under valgrind (memcheck). I would prefer
if it failed the testcase, but I'm not sure how to do that (some sanitizer

Going forward, it would be relativly easy to add a special case for single
listener signals to the original patch, but in the rather lengthy discussion we
had earlier, we concluded that we should try to fix clients from libwayland
But this could cause problems for code that uses wl_signal and wl_signal_emit
internally, since that should actually not touch any previously called
wl_listener in the signal list (until next emit).

A secondary emit_destroy (emit_final) path as suggested in [2] seems to be the
better way.


Markus Ongyerth (1):
  tests: Add free-without-remove test                 |  3 ++
 tests/free-without-remove.c | 70 +++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 73 insertions(+)
 create mode 100644 tests/free-without-remove.c


wayland-devel mailing list

Reply via email to