backend/session: fix crash on udev device remove event

libwayland adds phantom listeners here:
d81525a235/src/wayland-server.c (L2378)

Closes: https://gitlab.freedesktop.org/wlroots/wlroots/-/issues/3982
This commit is contained in:
Simon Ser 2025-10-01 16:58:49 +02:00
parent 2ec4012559
commit 406aa5f7f5

View file

@ -367,7 +367,10 @@ void wlr_session_close_file(struct wlr_session *session,
}
assert(wl_list_empty(&dev->events.change.listener_list));
assert(wl_list_empty(&dev->events.remove.listener_list));
// TODO: assert that the "remove" listener list is empty as well. Listeners
// will typically call wlr_session_close_file() in response, and
// wl_signal_emit_mutable() installs two phantom listeners, so we'd count
// these two.
close(dev->fd);
wl_list_remove(&dev->link);