qtdeclarative/tests/auto/qml/qqmlmoduleplugin/protectedModule
Ulf Hermann d0dc91158d 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 914e030079.

[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>
2021-08-17 16:14:53 +02:00
..
CMakeLists.txt
plugin.cpp Avoid querying the file system for qmldir files for locked modules 2021-08-17 16:14:53 +02:00
qmldir