diff options
| author | Ulf Hermann <ulf.hermann@qt.io> | 2026-09-24 10:00:53 +0200 |
|---|---|---|
| committer | Ulf Hermann <ulf.hermann@qt.io> | 2026-09-25 13:50:21 +0000 |
| commit | 5751600e2411bf68c305515c99cda9988b083e1e (patch) | |
| tree | e8a5f514400612961f5378c34e0b1536f2375cc6 /src | |
| parent | b200faedd4026bbfa8cbb12c7374f30c1a87e075 (diff) | |
qmlpreview: Don't try to compile .(m)js files as QML
We need to evict them from the cache on reload, but we shouldn't
re-compile them right away. That can be done on-demand the next time
they're requested.
Pick-to: 6.12
Fixes: QTBUG-150558
Change-Id: Ia339ee0f9ab110c3517a4c06cf150cfa99110246
Reviewed-by: Olivier De Cannière <olivier.decanniere@qt.io>
Diffstat (limited to 'src')
| -rw-r--r-- | src/plugins/qmltooling/qmldbg_preview/qqmlinplacepreviewhandler.cpp | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/plugins/qmltooling/qmldbg_preview/qqmlinplacepreviewhandler.cpp b/src/plugins/qmltooling/qmldbg_preview/qqmlinplacepreviewhandler.cpp index 21853852fd..90e3b6338b 100644 --- a/src/plugins/qmltooling/qmldbg_preview/qqmlinplacepreviewhandler.cpp +++ b/src/plugins/qmltooling/qmldbg_preview/qqmlinplacepreviewhandler.cpp @@ -200,10 +200,16 @@ void updateEngine(std::shared_ptr<InplaceUpdate> inplaceUpdate, const QList<QUrl { QV4::ExecutionEngine *v4 = inplaceUpdate->engine->handle(); std::vector<QQmlComponent *> components; + QQmlTypeLoader *typeLoader = v4->typeLoader(); for (const QUrl &url : urls) { + // Any file the application requests from the preview client is reported as dropped. + // Only QML documents can be recompiled as components. Scripts and qmldir files are merely + // evicted from the cache. + const bool isQmlDocument = typeLoader->isTypeLoaded(QQmlMetaType::normalizedUrl(url)); + // First remove any cached instance of the CU // NB: Don't remove from the ExecutionEngine's list of CUs. We need those for the GC. - if (!v4->typeLoader()->removeFromCache(url)) + if (!typeLoader->removeFromCache(url) || !isQmlDocument) continue; // Hold on to the old unit. |
