aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/qml/qqmlmetatypedata.cpp
diff options
context:
space:
mode:
authorUlf Hermann <ulf.hermann@qt.io>2019-02-05 15:30:42 +0100
committerUlf Hermann <ulf.hermann@qt.io>2019-02-08 16:09:46 +0000
commite2fe9d537c8f86a2e1d9cbfaf801fe58f817e9c5 (patch)
tree79735be4f2887f74b1604882b9216780d7fb0903 /src/qml/qml/qqmlmetatypedata.cpp
parent7fa5ef9e1ce87d9602c12d26442427c8604472ef (diff)
Eliminate excessive friendlyness of QQmlType
QQmlMetaTypeData does need to be exposed to the QQmlType ctors. Rather, we can use factory functions to create the QQmlTypePrivate objects. The static attachedPropertyIds should really be part of QQmlMetaTypeData and access to them should be protected by the lock. Task-number: QTBUG-73271 Change-Id: I154a3842fab03a02c710901a20afd1652364808d Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Diffstat (limited to 'src/qml/qml/qqmlmetatypedata.cpp')
-rw-r--r--src/qml/qml/qqmlmetatypedata.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/qml/qml/qqmlmetatypedata.cpp b/src/qml/qml/qqmlmetatypedata.cpp
index 989f1adf7c..f4f127ab9a 100644
--- a/src/qml/qml/qqmlmetatypedata.cpp
+++ b/src/qml/qml/qqmlmetatypedata.cpp
@@ -56,8 +56,13 @@ QQmlMetaTypeData::~QQmlMetaTypeData()
for (QHash<const QMetaObject *, QQmlPropertyCache *>::Iterator it = propertyCaches.begin(), end = propertyCaches.end();
it != end; ++it)
(*it)->release();
+
+ // Do this before the attached properties disappear.
+ types.clear();
+ undeletableTypes.clear();
}
+// This expects a "fresh" QQmlTypePrivate and adopts its reference.
void QQmlMetaTypeData::registerType(QQmlTypePrivate *priv)
{
for (int i = 0; i < types.count(); ++i) {
@@ -69,6 +74,7 @@ void QQmlMetaTypeData::registerType(QQmlTypePrivate *priv)
}
types.append(QQmlType(priv));
priv->index = types.count() - 1;
+ priv->refCount.deref();
}
QQmlPropertyCache *QQmlMetaTypeData::propertyCache(const QMetaObject *metaObject)