diff options
Diffstat (limited to 'src/qml/jsruntime/qv4executablecompilationunit.cpp')
-rw-r--r-- | src/qml/jsruntime/qv4executablecompilationunit.cpp | 45 |
1 files changed, 23 insertions, 22 deletions
diff --git a/src/qml/jsruntime/qv4executablecompilationunit.cpp b/src/qml/jsruntime/qv4executablecompilationunit.cpp index 0bdf5acba4..9b4b2353c5 100644 --- a/src/qml/jsruntime/qv4executablecompilationunit.cpp +++ b/src/qml/jsruntime/qv4executablecompilationunit.cpp @@ -272,12 +272,11 @@ void ExecutableCompilationUnit::unlink() if (engine) nextCompilationUnit.remove(); - if (isRegistered) { - Q_ASSERT(data && propertyCaches.count() > 0 && propertyCaches.at(/*root object*/0)); - QQmlMetaType::unregisterInternalCompositeType(this); - } - - propertyCaches.clear(); + // Clear the QQmlTypes but not the property caches. + // The property caches may still be necessary to resolve further types. + qmlType = QQmlType(); + for (auto &ic : inlineComponentData) + ic.qmlType = QQmlType(); if (runtimeLookups) { for (uint i = 0; i < data->lookupTableSize; ++i) @@ -382,26 +381,29 @@ void processInlinComponentType( } } -void ExecutableCompilationUnit::finalizeCompositeType(CompositeMetaTypeIds types) +void ExecutableCompilationUnit::finalizeCompositeType(const QQmlType &type) { // Add to type registry of composites if (propertyCaches.needsVMEMetaObject(/*root object*/0)) { - // typeIds is only valid for types that have references to themselves. - if (!types.isValid()) - types = CompositeMetaTypeIds::fromCompositeName(rootPropertyCache()->className()); - typeIds = types; - QQmlMetaType::registerInternalCompositeType(this); + // qmlType is only valid for types that have references to themselves. + if (type.isValid()) { + qmlType = type; + } else { + qmlType = QQmlMetaType::findCompositeType( + finalUrl(), this, (unitData()->flags & CompiledData::Unit::IsSingleton) + ? QQmlMetaType::Singleton + : QQmlMetaType::NonSingleton); + } + QQmlMetaType::registerInternalCompositeType(this); } else { const QV4::CompiledData::Object *obj = objectAt(/*root object*/0); auto *typeRef = resolvedTypes.value(obj->inheritedTypeNameIndex); Q_ASSERT(typeRef); - if (const auto compilationUnit = typeRef->compilationUnit()) { - typeIds = compilationUnit->typeIds; - } else { - const auto type = typeRef->type(); - typeIds = CompositeMetaTypeIds{ type.typeId(), type.qListTypeId() }; - } + if (const auto compilationUnit = typeRef->compilationUnit()) + qmlType = compilationUnit->qmlType; + else + qmlType = typeRef->type(); } // Collect some data for instantiation later. @@ -520,12 +522,11 @@ bool ExecutableCompilationUnit::verifyChecksum(const CompiledData::DependentType sizeof(data->dependencyMD5Checksum)) == 0; } -CompositeMetaTypeIds ExecutableCompilationUnit::typeIdsForComponent( - const QString &inlineComponentName) const +QQmlType ExecutableCompilationUnit::qmlTypeForComponent(const QString &inlineComponentName) const { if (inlineComponentName.isEmpty()) - return typeIds; - return inlineComponentData[inlineComponentName].typeIds; + return qmlType; + return inlineComponentData[inlineComponentName].qmlType; } QStringList ExecutableCompilationUnit::moduleRequests() const |