[platforms/drm] Return when property found

When initializing a property we loop through the drmModeObjectProperties
object and search for the property by its name.

Once found we create the Property object and there should be not another one
with the same name afterwards. In any case we would leak memory. Therefore just
directly return once the property was found.

This gives us the added benefit that we can put out a warning in case the
property was not found in the loop, what should not happen with the properties
we use.
This commit is contained in:
Roman Gilg 2019-12-11 18:37:52 +01:00
parent daa1cf9402
commit 7eafab7304

View file

@ -61,8 +61,10 @@ void DrmObject::initProp(int n, drmModeObjectProperties *properties, QVector<QBy
qCDebug(KWIN_DRM).nospace() << m_id << ": " << prop->name << "' (id " << prop->prop_id
<< "): " << properties->prop_values[i];
m_props[n] = new Property(prop.data(), properties->prop_values[i], enumNames);
return;
}
}
qCWarning(KWIN_DRM) << "Initializing property" << m_propsNames[n] << "failed";
}
bool DrmObject::atomicPopulate(drmModeAtomicReq *req) const