diff options
author | Simon Hausmann <simon.hausmann@qt.io> | 2017-01-02 10:46:38 +0100 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@qt.io> | 2017-01-02 09:55:07 +0000 |
commit | f43dc181d7416eddfafb7493273a371c1eba8b4a (patch) | |
tree | 8ed5d657fa5f1f2943ab6a4f7cef0c71ff512085 /src/qml/compiler/qv4compileddata.cpp | |
parent | b2501b0bda6a0bf4f4d5ce19e7efeda236bcbe9a (diff) |
Fix QML cache not being invalidated when source path changes
When somebody renames the directory name underneath a QML file and its
cache file, then we need to re-generate the cache as it contains the
fully path of the source path. That is sometimes used to resolve
relative URLs (such as images) and therefore needs updating (by
re-creating the cache).
Task-number: QTBUG-57644
Change-Id: I9766668859aad8e9d71f278c3f26c0585258c14e
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Diffstat (limited to 'src/qml/compiler/qv4compileddata.cpp')
-rw-r--r-- | src/qml/compiler/qv4compileddata.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/qml/compiler/qv4compileddata.cpp b/src/qml/compiler/qv4compileddata.cpp index 8586c84c3d..6aac111897 100644 --- a/src/qml/compiler/qv4compileddata.cpp +++ b/src/qml/compiler/qv4compileddata.cpp @@ -407,6 +407,11 @@ bool CompilationUnit::loadFromDisk(const QUrl &url, EvalISelFactory *iselFactory const Unit * const oldDataPtr = (data && !(data->flags & QV4::CompiledData::Unit::StaticData)) ? data : nullptr; QScopedValueRollback<const Unit *> dataPtrChange(data, mappedUnit); + if (sourcePath != QQmlFile::urlToLocalFileOrQrc(stringAt(data->sourceFileIndex))) { + *errorString = QStringLiteral("QML source file has moved to a different location."); + return false; + } + { const QString foundArchitecture = stringAt(data->architectureIndex); const QString expectedArchitecture = QSysInfo::buildAbi(); |