diff --git a/src/wayland/drmleasedevice_v1_interface.cpp b/src/wayland/drmleasedevice_v1_interface.cpp index bffd22cdb4..7e33802214 100644 --- a/src/wayland/drmleasedevice_v1_interface.cpp +++ b/src/wayland/drmleasedevice_v1_interface.cpp @@ -84,10 +84,6 @@ void DrmLeaseDeviceV1InterfacePrivate::remove() request->connectors.clear(); } globalRemove(); - removed = true; - if (resourceMap().isEmpty()) { - delete this; - } } void DrmLeaseDeviceV1InterfacePrivate::registerConnector(DrmLeaseConnectorV1Interface *connector) @@ -144,6 +140,9 @@ void DrmLeaseDeviceV1InterfacePrivate::wp_drm_lease_device_v1_release(Resource * void DrmLeaseDeviceV1InterfacePrivate::wp_drm_lease_device_v1_bind_resource(Resource *resource) { + if (isGlobalRemoved()) { + return; + } if (!hasDrmMaster) { pendingFds << resource->handle; return; @@ -161,12 +160,9 @@ void DrmLeaseDeviceV1InterfacePrivate::wp_drm_lease_device_v1_bind_resource(Reso } } -void DrmLeaseDeviceV1InterfacePrivate::wp_drm_lease_device_v1_destroy_resource(Resource *resource) +void DrmLeaseDeviceV1InterfacePrivate::wp_drm_lease_device_v1_destroy_global() { - Q_UNUSED(resource) - if (removed && resourceMap().isEmpty()) { - delete this; - } + delete this; } diff --git a/src/wayland/drmleasedevice_v1_interface_p.h b/src/wayland/drmleasedevice_v1_interface_p.h index 4bef36e401..085aac8573 100644 --- a/src/wayland/drmleasedevice_v1_interface_p.h +++ b/src/wayland/drmleasedevice_v1_interface_p.h @@ -44,7 +44,7 @@ protected: 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; }; class DrmLeaseConnectorV1InterfacePrivate : public QObject, public QtWaylandServer::wp_drm_lease_connector_v1