Verified Commit dc09ce85 authored by Xuetian Weng's avatar Xuetian Weng
Browse files

Fix race in wp_drm_lease_v1.

Basically this is a well known issue in wayland for globals. If bind
comes after destroyed, it will raise a invalid global error. The common
practice is to delay the destroy of global. Similar technique is also
applied to wl_output.

CCBUG: 452435
(cherry picked from commit cdc9dcfb)
parent 40364d2e
Pipeline #164778 passed with stage
in 3 minutes and 5 seconds
......@@ -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;
}
......
......@@ -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
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment