aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorUlf Hermann <ulf.hermann@qt.io>2018-12-12 15:16:27 +0100
committerUlf Hermann <ulf.hermann@qt.io>2019-03-28 12:37:49 +0000
commit9de640b8198c517411971a881c6b77a05a668123 (patch)
treebf26027d6de6d60c82d80b478ba1c66e7af1fff9
parentd10ddb040a0be1e179c60d0e364c7ab28b059e15 (diff)
QML: Delete plugin loaders on shutdown
The StringRegisteredPluginMap owns its QPluginLoaders. Therefore, it should delete them in the end. ASAN complains if not. Change-Id: Iecd425e340d13db5cecd44bb123818e2c2a3b6a5 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io> Reviewed-by: BogDan Vatra <bogdan@kdab.com>
-rw-r--r--src/qml/qml/qqmlimport.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/qml/qml/qqmlimport.cpp b/src/qml/qml/qqmlimport.cpp
index 454bd3abfb..09d430b5c0 100644
--- a/src/qml/qml/qqmlimport.cpp
+++ b/src/qml/qml/qqmlimport.cpp
@@ -141,6 +141,13 @@ struct RegisteredPlugin {
struct StringRegisteredPluginMap : public QMap<QString, RegisteredPlugin> {
QMutex mutex;
+
+ ~StringRegisteredPluginMap()
+ {
+ QMutexLocker lock(&mutex);
+ for (const RegisteredPlugin &plugin : qAsConst(*this))
+ delete plugin.loader;
+ }
};
Q_GLOBAL_STATIC(StringRegisteredPluginMap, qmlEnginePluginsWithRegisteredTypes); // stores the uri and the PluginLoaders