diff options
author | Simon Hausmann <simon.hausmann@qt.io> | 2017-09-12 15:13:33 +0200 |
---|---|---|
committer | Lars Knoll <lars.knoll@qt.io> | 2017-09-12 19:50:13 +0000 |
commit | 98358715930739ca8de172d88c5ce6941c275ff3 (patch) | |
tree | 614a2af39d4b8fc122d3900281c6a3ca1ec8331e /src/qml/qml/qqmlimport.cpp | |
parent | 78d574a909a4bcf7543fba8d921e8658dfbc0200 (diff) |
Fix qml cache invalidation when changing dependent C++ registered QML singletons
When a qml file uses a qml singleton, we need to reliably detect when
the singleton changes and re-generate the cache of the qml file using
it. This is a scenario covered and fixed by commit
5b94de09cc738837d1539e28b3c0dccd17c18d29, with the exception that
currently QML singletons registered via qmlRegisterSingleton were not
added to the list of dependent singletons for a qml file. We can fix
this by extending findCompositeSingletons() to also cover the singletons
that do not originate from a qmldir file.
[ChangeLog][Qt][Qml] Fixed bug where sometimes changes to a qml
singleton would not propagate to the users or cause crashes.
Task-number: QTBUG-62243
Change-Id: I16c3d9ba65fd82e898a29b946c341907751135a9
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Diffstat (limited to 'src/qml/qml/qqmlimport.cpp')
-rw-r--r-- | src/qml/qml/qqmlimport.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/qml/qml/qqmlimport.cpp b/src/qml/qml/qqmlimport.cpp index 0bd7317470..ccd287e1b6 100644 --- a/src/qml/qml/qqmlimport.cpp +++ b/src/qml/qml/qqmlimport.cpp @@ -471,6 +471,17 @@ void findCompositeSingletons(const QQmlImportNamespace &set, QList<QQmlImports:: resultList.append(ref); } } + + if (QQmlTypeModule *module = QQmlMetaType::typeModule(import->uri, import->majversion)) { + module->walkCompositeSingletons([&resultList, &set](const QQmlType &singleton) { + QQmlImports::CompositeSingletonReference ref; + ref.typeName = singleton.elementName(); + ref.prefix = set.prefix; + ref.majorVersion = singleton.majorVersion(); + ref.minorVersion = singleton.minorVersion(); + resultList.append(ref); + }); + } } } |