diff options
| author | Ulf Hermann <ulf.hermann@qt.io> | 2023-02-10 09:07:38 +0100 |
|---|---|---|
| committer | Ulf Hermann <ulf.hermann@qt.io> | 2023-02-10 23:22:30 +0100 |
| commit | 0a5eff09203ebb2547431de689d9c07e6c97f636 (patch) | |
| tree | f8670c9bd7bb9b396569a720babaa039c150dc18 /src/qml/jsruntime/qv4executablecompilationunit.cpp | |
| parent | 32dac75fb47cc21626e9d8a3f9b07889cb3dad37 (diff) | |
QML: Invalidate any existing cache files when saving a CU to disk
Otherwise we just re-load the old cache file next time. That's clearly
not intended.
Pick-to: 6.5 6.4 6.2
Fixes: QTBUG-111078
Change-Id: Ia65b46880eca2b6e8c4792a09f20716125beada3
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Diffstat (limited to 'src/qml/jsruntime/qv4executablecompilationunit.cpp')
| -rw-r--r-- | src/qml/jsruntime/qv4executablecompilationunit.cpp | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/qml/jsruntime/qv4executablecompilationunit.cpp b/src/qml/jsruntime/qv4executablecompilationunit.cpp index 898f911334..7a57aa3186 100644 --- a/src/qml/jsruntime/qv4executablecompilationunit.cpp +++ b/src/qml/jsruntime/qv4executablecompilationunit.cpp @@ -875,8 +875,14 @@ bool ExecutableCompilationUnit::saveToDisk(const QUrl &unitUrl, QString *errorSt return CompiledData::SaveableUnitPointer(unitData()).saveToDisk<char>( [&unitUrl, errorString](const char *data, quint32 size) { - return CompiledData::SaveableUnitPointer::writeDataToFile(localCacheFilePath(unitUrl), data, - size, errorString); + const QString cachePath = localCacheFilePath(unitUrl); + if (CompiledData::SaveableUnitPointer::writeDataToFile( + cachePath, data, size, errorString)) { + CompilationUnitMapper::invalidate(cachePath); + return true; + } + + return false; }); } |
