diff options
author | Lars Knoll <lars.knoll@qt.io> | 2020-08-24 14:10:41 +0200 |
---|---|---|
committer | Fabian Kosmale <fabian.kosmale@qt.io> | 2020-08-28 13:49:08 +0200 |
commit | 8248b5a485a2b8885442d6511906526548d9d07e (patch) | |
tree | 07d17281483f54fcbe28ed5a1add80ae0313e381 /src/qml/jsruntime/qv4executablecompilationunit.cpp | |
parent | 43a532deffce7ee8c273dbff19c1b0ca941e636d (diff) |
Always group the metaType and listType together
They are always created and destroyed together, so grouping
them makes the required memory management of them easier.
Change-Id: Ia1980f31f9bdff6a1accd229bc8380ae153edf67
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Diffstat (limited to 'src/qml/jsruntime/qv4executablecompilationunit.cpp')
-rw-r--r-- | src/qml/jsruntime/qv4executablecompilationunit.cpp | 19 |
1 files changed, 8 insertions, 11 deletions
diff --git a/src/qml/jsruntime/qv4executablecompilationunit.cpp b/src/qml/jsruntime/qv4executablecompilationunit.cpp index 0535e5029f..9d8332ea55 100644 --- a/src/qml/jsruntime/qv4executablecompilationunit.cpp +++ b/src/qml/jsruntime/qv4executablecompilationunit.cpp @@ -302,8 +302,8 @@ void ExecutableCompilationUnit::unlink() Q_ASSERT(data && propertyCaches.count() > 0 && propertyCaches.at(/*root object*/0)); if (qmlEngine) qmlEngine->unregisterInternalCompositeType(this); - QQmlMetaType::unregisterInternalCompositeType({metaTypeId, listMetaTypeId}); isRegisteredWithEngine = false; + QQmlMetaType::unregisterInternalCompositeType(typeIds); } propertyCaches.clear(); @@ -402,17 +402,16 @@ IdentifierHash ExecutableCompilationUnit::createNamedObjectsPerComponent(int com return *namedObjectsPerComponentCache.insert(componentObjectIndex, namedObjectCache); } -void ExecutableCompilationUnit::finalizeCompositeType(QQmlEnginePrivate *qmlEngine, CompositeMetaTypeIds typeIds) +void ExecutableCompilationUnit::finalizeCompositeType(QQmlEnginePrivate *qmlEngine, CompositeMetaTypeIds types) { this->qmlEngine = qmlEngine; // Add to type registry of composites if (propertyCaches.needsVMEMetaObject(/*root object*/0)) { // typeIds is only valid for types that have references to themselves. - if (!typeIds.isValid()) - typeIds = QQmlMetaType::registerInternalCompositeType(rootPropertyCache()->className()); - metaTypeId = typeIds.id; - listMetaTypeId = typeIds.listId; + if (!types.isValid()) + types = QQmlMetaType::registerInternalCompositeType(rootPropertyCache()->className()); + typeIds = types; qmlEngine->registerInternalCompositeType(this); } else { @@ -420,12 +419,10 @@ void ExecutableCompilationUnit::finalizeCompositeType(QQmlEnginePrivate *qmlEngi auto *typeRef = resolvedTypes.value(obj->inheritedTypeNameIndex); Q_ASSERT(typeRef); if (const auto compilationUnit = typeRef->compilationUnit()) { - metaTypeId = compilationUnit->metaTypeId; - listMetaTypeId = compilationUnit->listMetaTypeId; + typeIds = compilationUnit->typeIds; } else { const auto type = typeRef->type(); - metaTypeId = type.typeId(); - listMetaTypeId = type.qListTypeId(); + typeIds = CompositeMetaTypeIds{ type.typeId(), type.qListTypeId() }; } } @@ -549,7 +546,7 @@ bool ExecutableCompilationUnit::verifyChecksum(const CompiledData::DependentType CompositeMetaTypeIds ExecutableCompilationUnit::typeIdsForComponent(int objectid) const { if (objectid == 0) - return {metaTypeId, listMetaTypeId}; + return typeIds; return inlineComponentData[objectid].typeIds; } |