aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/jsruntime/qv4engine.cpp
diff options
context:
space:
mode:
authorUlf Hermann <ulf.hermann@qt.io>2024-09-18 10:14:13 +0200
committerUlf Hermann <ulf.hermann@qt.io>2024-09-20 18:55:30 +0200
commite1a0eb98e60588862d79fa074b65217a96bdaab5 (patch)
treeaafe7ef524916441b7a094523d68a8ebdc7d47b4 /src/qml/jsruntime/qv4engine.cpp
parent9855d7477163cc56742a1766d35346d8058f2794 (diff)
QtQml: Decouple JavaScript library CUs from engines
In order to re-use the compilation units for JavaScript libraries, we need to eliminate the "m_value" member they are carrying, indirectly. The values are tied to specific engines and invalid in others. Luckily, we already have two suitable places to store such values: 1. In case of a "native" module without a compilation unit we have the nativeModules hash in ExecutionEngine. 2. In case of a module or library backed by a CU we have the "module" member of ExecutableCompilationUnit. This can currently only hold modules but there is no reason why it wouldn't hold JavaScript libraries equally well. By using the "empty" V4 value we can also get rid of the m_loaded bool. As a drive by, correct the QQmlScriptBlob::isNative() misnomer. We don't want to know whether the script is native (for any value of that), but rather whether it has a value. Pick-to: 6.8 Fixes: QTBUG-129052 Change-Id: I284823f4aa26e46dec8328f88f65877f59e40f79 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, 1 insertions, 1 deletions
diff --git a/src/qml/jsruntime/qv4engine.cpp b/src/qml/jsruntime/qv4engine.cpp
index cd1a4e033c..b392ba4807 100644
--- a/src/qml/jsruntime/qv4engine.cpp
+++ b/src/qml/jsruntime/qv4engine.cpp
@@ -2162,7 +2162,7 @@ QV4::Value *ExecutionEngine::registerNativeModule(const QUrl &url, const QV4::Va
// Make sure the type loader doesn't try to resolve the script anymore.
if (m_qmlEngine)
- QQmlEnginePrivate::get(m_qmlEngine)->typeLoader.injectScript(url, *val);
+ QQmlEnginePrivate::get(m_qmlEngine)->typeLoader.injectScript(url);
return val;
}