xserver/hw
Olivier Fourdan f6cd168d38 xwayland: Do not remove output on withdraw if leased
On DRM lease connector withdrawn event, Xwayland would free the
corresponding xwl_output offered for lease.

However, the pointer is still referenced from the rrLease->outputs[],
meaning that trying to clean up the RANDR DRM leases as done with commit
ef181265 (xwayland: Clean up drm lease when terminating) would cause a
use after free and random crashes.

To avoid that issue, on the connector withdraw event, set the connector
withdrawn flag but do not to remove (i.e. free) the xwayland output if
its is offered for lease.

Then, once the lease is terminated, check for the xwl_outputs with a
withdrawn connector and remove them (once we have no use for them
anymore.

Note that we cannot do that cleanup from xwl_randr_terminate_lease() as
removing the xwl_output will free the RRcrtc resources, which checks for
leases in XRANDR, and calls RRTerminateLease(), which chains back to
xwl_randr_terminate_lease().

v2: Use a "withdrawn_connector" flag to mark outputs to remove (Xaver)

Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Reviewed-by: Xaver Hugl <xaver.hugl@kde.org>
fixes: ef181265 - xwayland: Clean up drm lease when terminating

See-also: https://gitlab.freedesktop.org/xorg/xserver/-/issues/946
See-also: https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1130
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1482>
(cherry picked from commit 4053782443)
2026-01-25 10:39:53 -08:00
..
kdrive rename remaining RT_* defines to X11_RESTYPE_* 2026-01-19 12:48:30 -08:00
vfb Xvfb: Support up to 13 mouse buttons 2024-01-08 11:16:11 +00:00
xfree86 dbe: unexport dbestruct.h 2026-01-25 10:39:52 -08:00
xnest rename remaining RT_* defines to X11_RESTYPE_* 2026-01-19 12:48:30 -08:00
xquartz Fix missing include of sys/stat.h 2026-01-19 12:48:30 -08:00
xwayland xwayland: Do not remove output on withdraw if leased 2026-01-25 10:39:53 -08:00
xwin rename remaining RT_* defines to X11_RESTYPE_* 2026-01-19 12:48:30 -08:00
meson.build Drop DMX DDX 2021-09-07 09:34:31 +00:00