diff options
author | Ulf Hermann <ulf.hermann@qt.io> | 2024-01-05 14:08:32 +0100 |
---|---|---|
committer | Ulf Hermann <ulf.hermann@qt.io> | 2024-01-11 00:42:17 +0100 |
commit | 7a9a778604a03473b6c4ef8a481ba3cc06d48265 (patch) | |
tree | 52ba86a5f11a8dab39e194439f743f294d0ffc6f /src/qml/qml/qqml.cpp | |
parent | 5eba4080511a006d10fc86d141d3f0f5abf0b8f8 (diff) |
QtQml: Remove QQmlTypeLoader from QQmlImport
The type loader belongs to the engine and we must not store it in
engine-independent data structures. We do want the import cache to be
stored in the type registry, though (in a separate change).
Change-Id: I2828f5098b27bf1fc96852fc2bd160db44b109e7
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Diffstat (limited to 'src/qml/qml/qqml.cpp')
-rw-r--r-- | src/qml/qml/qqml.cpp | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/src/qml/qml/qqml.cpp b/src/qml/qml/qqml.cpp index 6533deebf5..46e83d532e 100644 --- a/src/qml/qml/qqml.cpp +++ b/src/qml/qml/qqml.cpp @@ -1982,8 +1982,12 @@ static void initTypeWrapperLookup( if (importNamespace != AOTCompiledContext::InvalidStringId) { QV4::Scope scope(context->engine->handle()); QV4::ScopedString import(scope, context->compilationUnit->runtimeStrings[importNamespace]); + + QQmlTypeLoader *typeLoader = scope.engine->typeLoader(); + Q_ASSERT(typeLoader); if (const QQmlImportRef *importRef - = context->qmlContext->imports()->query(import).importNamespace) { + = context->qmlContext->imports()->query(import, typeLoader).importNamespace) { + QV4::Scoped<QV4::QQmlTypeWrapper> wrapper( scope, QV4::QQmlTypeWrapper::create( scope.engine, nullptr, context->qmlContext->imports(), importRef)); @@ -2042,12 +2046,16 @@ void AOTCompiledContext::initLoadAttachedLookup( QV4::ScopedString name(scope, compilationUnit->runtimeStrings[l->nameIndex]); QQmlType type; + QQmlTypeLoader *typeLoader = scope.engine->typeLoader(); + Q_ASSERT(typeLoader); if (importNamespace != InvalidStringId) { QV4::ScopedString import(scope, compilationUnit->runtimeStrings[importNamespace]); - if (const QQmlImportRef *importRef = qmlContext->imports()->query(import).importNamespace) - type = qmlContext->imports()->query(name, importRef).type; + if (const QQmlImportRef *importRef + = qmlContext->imports()->query(import, typeLoader).importNamespace) { + type = qmlContext->imports()->query(name, importRef, typeLoader).type; + } } else { - type = qmlContext->imports()->query<QQmlImport::AllowRecursion>(name).type; + type = qmlContext->imports()->query<QQmlImport::AllowRecursion>(name, typeLoader).type; } if (!type.isValid()) { |