diff options
Diffstat (limited to 'src/qml/qml/qqmlmetatypedata.cpp')
-rw-r--r-- | src/qml/qml/qqmlmetatypedata.cpp | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/src/qml/qml/qqmlmetatypedata.cpp b/src/qml/qml/qqmlmetatypedata.cpp index ab6054349a..bc7e762e53 100644 --- a/src/qml/qml/qqmlmetatypedata.cpp +++ b/src/qml/qml/qqmlmetatypedata.cpp @@ -15,8 +15,12 @@ QQmlMetaTypeData::QQmlMetaTypeData() QQmlMetaTypeData::~QQmlMetaTypeData() { - for (auto iter = compositeTypes.cbegin(), end = compositeTypes.cend(); iter != end; ++iter) - iter.value()->isRegistered = false; + { + // Unregister all remaining composite types. + // Avoid deletion recursion (via QQmlTypePrivate dtor) by moving them out of the way first. + CompositeTypes emptyComposites; + emptyComposites.swap(compositeTypes); + } propertyCaches.clear(); // Do this before the attached properties disappear. @@ -137,6 +141,7 @@ QQmlPropertyCache::ConstPtr QQmlMetaTypeData::propertyCache( quint8 maxMinorVersion = 0; const QMetaObject *metaObject = type.metaObject(); + Q_ASSERT(metaObject); const QTypeRevision combinedVersion = version.hasMajorVersion() ? version @@ -236,13 +241,11 @@ QQmlPropertyCache::ConstPtr QQmlMetaTypeData::propertyCache( } static QQmlPropertyCache::ConstPtr propertyCacheForPotentialInlineComponentType( - QMetaType t, - const QHash<const QtPrivate::QMetaTypeInterface *, - QV4::ExecutableCompilationUnit *>::const_iterator &iter) { - if (t != (*iter)->typeIds.id) { + QMetaType t, const QQmlMetaTypeData::CompositeTypes::const_iterator &iter) { + if (t != (*iter)->metaType()) { // this is an inline component, and what we have in the iterator is currently the parent compilation unit for (auto &&icDatum: (*iter)->inlineComponentData) - if (icDatum.typeIds.id == t) + if (icDatum.qmlType.typeId() == t) return (*iter)->propertyCaches.at(icDatum.objectIndex); } return (*iter)->rootPropertyCache(); |