wayland: Fix a crash in DrmLeaseDeviceV1Interface::setDrmMaster()

The case when a resource is destroyed before kwin becomes the drm master
again is not handled. It can leave dangling pointers in m_pendingFds.
This commit is contained in:
Vlad Zahorodnii 2024-03-04 11:25:40 +02:00
parent 3b28788592
commit 9e77e5038f
2 changed files with 6 additions and 0 deletions

View file

@ -241,6 +241,11 @@ void DrmLeaseDeviceV1Interface::wp_drm_lease_device_v1_bind_resource(Resource *r
send_done(resource->handle);
}
void DrmLeaseDeviceV1Interface::wp_drm_lease_device_v1_destroy_resource(Resource *resource)
{
m_pendingFds.removeOne(resource->handle);
}
void DrmLeaseDeviceV1Interface::wp_drm_lease_device_v1_destroy_global()
{
delete this;

View file

@ -49,6 +49,7 @@ private:
void wp_drm_lease_device_v1_create_lease_request(Resource *resource, uint32_t id) override;
void wp_drm_lease_device_v1_release(Resource *resource) override;
void wp_drm_lease_device_v1_bind_resource(Resource *resource) override;
void wp_drm_lease_device_v1_destroy_resource(Resource *resource) override;
void wp_drm_lease_device_v1_destroy_global() override;
DrmGpu *const m_gpu;