From e2fe9d537c8f86a2e1d9cbfaf801fe58f817e9c5 Mon Sep 17 00:00:00 2001 From: Ulf Hermann Date: Tue, 5 Feb 2019 15:30:42 +0100 Subject: 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 --- src/qml/qml/qqmlmetatypedata.cpp | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/qml/qml/qqmlmetatypedata.cpp') 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::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) -- cgit v1.2.3