aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/qml/qqmlmoduleplugin
diff options
context:
space:
mode:
authorUlf Hermann <ulf.hermann@qt.io>2021-08-10 12:21:58 +0200
committerUlf Hermann <ulf.hermann@qt.io>2021-08-17 16:14:53 +0200
commitd0dc91158d0b44d9e1b73c3b0dacdd6699741ad7 (patch)
tree331cab9fff2169cb76e33ca80d82a175e56e91c0 /tests/auto/qml/qqmlmoduleplugin
parentb4ab58d791167329259f5403e52ce6c85b5f0074 (diff)
Avoid querying the file system for qmldir files for locked modules
If the user explicitly locks a module using qmlProtectModule, we don't load any additional qmldir files afterwards. In particular, this means you can only do that with modules that don't contain qmldir files or with modules for which the qmldir files have already been loaded in all engines that need them. This is in contrast to the "weak" locking we automatically perform when loading a plugin. When importing the module again after loading a plugin we do want to re-evaluate the qmldir directives. If the module is imported from a different engine than before, we also have to search for the qmldir file again. Amends commit 914e0300792856ddac9b99b20a8d88dd6f087fa6. [ChangeLog][QtQml] The pre-5.15 behavior of qmlProtectModule() has mostly been restored: If you explicitly protect a module, the QML engine will never look for any qmldir files or plugins for that module again. This severely limits what you can do with such a module. However, once all affected engines have loaded the module, protecting it can be a useful optimization. In contrast to pre-5.15, the qmldir cache for such modules continues to be re-used even after they are locked. Therefore, in QML engines that have loaded the module before, you can expect any "prefer" or "import" directives and any composite types to still be available after protecting the module. Fixes: QTBUG-85591 Pick-to: 6.2 Change-Id: Ia4edd860e2ddda5e0c419e1ce9764f10f32ace1f Reviewed-by: Thorbjørn Lindeijer <bjorn@lindeijer.nl> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Andrei Golubev <andrei.golubev@qt.io> Reviewed-by: Fawzi Mohamed <fawzi.mohamed@qt.io>
Diffstat (limited to 'tests/auto/qml/qqmlmoduleplugin')
-rw-r--r--tests/auto/qml/qqmlmoduleplugin/protectedModule/plugin.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/tests/auto/qml/qqmlmoduleplugin/protectedModule/plugin.cpp b/tests/auto/qml/qqmlmoduleplugin/protectedModule/plugin.cpp
index 4b58348962..8321e02d79 100644
--- a/tests/auto/qml/qqmlmoduleplugin/protectedModule/plugin.cpp
+++ b/tests/auto/qml/qqmlmoduleplugin/protectedModule/plugin.cpp
@@ -47,9 +47,9 @@ public:
void registerTypes(const char *uri) override
{
- // The module is protected. The plugin can still be loaded, but it cannot register
- // any types.
+ // Because the module is protected, this plugin should never be loaded
Q_UNUSED(uri);
+ Q_UNREACHABLE();
}
};