From 018a41a123d9e599580994173d9dde1dbdb63479 Mon Sep 17 00:00:00 2001 From: Vlad Zahorodnii Date: Fri, 26 Aug 2022 16:07:49 +0300 Subject: [PATCH] wayland: Fix lease termination in wp_lease_v1_destroy() If a drm lease is destroyed, e.g. the app has unexpectedly terminated, only the finished event will be sent. The leaseRevoked signal won't be emitted so the drm backend can't clean up DrmOutput::m_lease. Since m_lease can be a dangling pointer, the drm backend can crash in DrmGpu::updateOutputs() when it tries to determine if m_lease is still alive and was not terminated by closing the lease fd on the client side. --- src/wayland/drmleasedevice_v1_interface.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/wayland/drmleasedevice_v1_interface.cpp b/src/wayland/drmleasedevice_v1_interface.cpp index 55ea671c65..85682f4c32 100644 --- a/src/wayland/drmleasedevice_v1_interface.cpp +++ b/src/wayland/drmleasedevice_v1_interface.cpp @@ -320,7 +320,12 @@ DrmLeaseV1Interface::DrmLeaseV1Interface(DrmLeaseDeviceV1InterfacePrivate *devic DrmLeaseV1Interface::~DrmLeaseV1Interface() { - deny(); + if (d->lesseeId) { + revoke(); + } else { + deny(); + } + d->device->leases.removeOne(this); }