summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDominik Holland <dominik.holland@qt.io>2024-02-01 11:02:59 +0100
committerDominik Holland <dominik.holland@qt.io>2024-02-01 15:13:43 +0100
commita25e3a1c158d555b319518d6c98c0b1adae953ef (patch)
tree83e0be0a7ab1b51ae228c75a416a9199512fa417
parent33532f3dd111cb223d6cd28e9738c2b6d54f79ee (diff)
Only load container plugins which are actually used
Only load the container plugin if there is a configuration for it as well. Pick-to: 6.7 Change-Id: I082cf9bf9d78779ca9a2f3e30be9bfa8a76bd0a4 Reviewed-by: Robert Griebl <robert.griebl@qt.io>
-rw-r--r--doc/container.qdoc9
-rw-r--r--src/main-lib/main.cpp4
2 files changed, 11 insertions, 2 deletions
diff --git a/doc/container.qdoc b/doc/container.qdoc
index c8ded008..3c2e5285 100644
--- a/doc/container.qdoc
+++ b/doc/container.qdoc
@@ -44,8 +44,13 @@ plugins:
\endcode
Plugins installed into Qt's plugin directory into the \c appman_container folder are picked
-up automatically, but you still need to enable the usage of the container using the
-\l{container-selection}{container selection} configuration.
+up automatically, but you still need to enable the usage of the container by having an entry
+for the container's id in the main \c containers: configuration field:
+
+\badcode
+containers:
+ bubblewrap: ...
+\endcode
\target container-selection
\section1 Container Selection Configuration
diff --git a/src/main-lib/main.cpp b/src/main-lib/main.cpp
index 17b3dbaa..7c3284bf 100644
--- a/src/main-lib/main.cpp
+++ b/src/main-lib/main.cpp
@@ -484,9 +484,13 @@ void Main::setupRuntimesAndContainers(const QVariantMap &runtimeConfigurations,
systemContainerPluginPaths += filePath;
}
+ QSet<QString> containersWithConfiguration (containerConfigurations.keyBegin(), containerConfigurations.keyEnd());
+
auto containerPlugins = loadPlugins<ContainerManagerInterface>("container", systemContainerPluginPaths + containerPluginPaths);
pluginContainerManagers.reserve(containerPlugins.size());
for (auto iface : std::as_const(containerPlugins)) {
+ if (!containersWithConfiguration.contains(iface->identifier()))
+ continue;
auto pcm = new PluginContainerManager(iface);
pluginContainerManagers << pcm;
ContainerFactory::instance()->registerContainer(pcm);