wlroots/include/xwayland
David Turner ea1ade5e5d xwm: Fix double-close
When an FD is passed to xcb_connect_to_fd(), xcb takes ownership of that
FD and is responsible for closing it, which it does when
xcb_disconnect() is called.  But the xwayland handler code also keeps a
copy of the FD and closes it via safe_close() in
server_finish_process().

This double-close can cause all sorts of problems if another part of
wlroots allocates another FD between the two closes - the latter close
will close the wrong FD and things go horribly wrong (in my case leading
to use-after-free and segfaults).

Fix this by setting wm_fd[0]=-1 after calling xwm_create(), and ensuring
that xwm_create() closes the FD if startup errors occur.

(cherry picked from commit 879243e370)
2025-10-21 10:25:40 -04:00
..
selection.h Add some missing includes/declarations 2023-06-05 21:06:19 +00:00
xwm.h xwm: Fix double-close 2025-10-21 10:25:40 -04:00