aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/jsruntime/qv4engine.cpp
diff options
context:
space:
mode:
authorUlf Hermann <ulf.hermann@qt.io>2025-01-23 11:45:10 +0100
committerUlf Hermann <ulf.hermann@qt.io>2025-02-06 23:11:37 +0100
commit23ba0274051996c83434f4b231e7d0a46051e7d2 (patch)
tree6c428e90c3a8add8baff21a2d8207cf00c35ef67 /src/qml/jsruntime/qv4engine.cpp
parent056b59e46e62130886475120a9abba7a7c9b94a4 (diff)
QtQml: Store script CUs in QQmlMetaTypeData
When importing a JavaScript module again from the same QML engine, the resulting executable compilation unit should be the same as before. This only works if we use the same base compilation unit. However, so far QQmlScriptBlob did not store the compilation unit in the central type registry. Therefore, it could not be found when importing the module again. This broke when we transitioned away from storing JavaScript modules in a separate data structure and instead started treating them like any other compilation units. In order to fix this, generate synthetic QQmlType and QMetaType instances also for JavaScript compilation units and store them in the relevant data structures. This makes it possible to locate them when we need them. Pick-to: 6.9 6.8 Fixes: QTBUG-133053 Change-Id: I0425cd70a3745e793fec03105f58b708726ede06 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Diffstat (limited to 'src/qml/jsruntime/qv4engine.cpp')
-rw-r--r--src/qml/jsruntime/qv4engine.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/qml/jsruntime/qv4engine.cpp b/src/qml/jsruntime/qv4engine.cpp
index 334ef96023..9bb07e4ffd 100644
--- a/src/qml/jsruntime/qv4engine.cpp
+++ b/src/qml/jsruntime/qv4engine.cpp
@@ -2166,6 +2166,8 @@ ExecutionEngine::Module ExecutionEngine::loadModule(
const QUrl &url, const ExecutableCompilationUnit *referrer)
{
return doFindModule(m_compilationUnits, url, referrer, [this](const QUrl &resolved) {
+ if (auto cu = QQmlMetaType::obtainCompilationUnit(resolved))
+ return executableCompilationUnit(std::move(cu));
return compileModule(resolved);
});
}