xserver/hw
Olivier Fourdan 4053782443 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>
2024-04-30 09:13:34 +02:00
..
kdrive include: split out non-exported prototypes to dix_priv.h 2024-04-30 00:47:38 +00:00
vfb os: unexport Os*() functions 2024-04-16 14:20:30 +02:00
xfree86 include: move private definitions out of exevents.h 2024-04-30 00:47:38 +00:00
xnest include: move private definitions out of extinit.h 2024-04-30 00:47:38 +00:00
xquartz include: move private definitions out of extinit.h 2024-04-30 00:47:38 +00:00
xwayland xwayland: Do not remove output on withdraw if leased 2024-04-30 09:13:34 +02:00
xwin include: move private definitions out of extinit.h 2024-04-30 00:47:38 +00:00
meson.build Drop DMX DDX 2021-09-07 09:34:31 +00:00