aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/qml/qqmlimport.cpp
diff options
context:
space:
mode:
authorAlan Alpert <aalpert@rim.com>2013-01-24 14:07:29 -0800
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-05-07 19:41:28 +0200
commit9b5a55101d7c519446c1cf3706a235dea81ad4de (patch)
tree8f7201f04f8e593c8e00fd4d293d2d28e1a655ab /src/qml/qml/qqmlimport.cpp
parent223313479bf8ec80158ba0f6cba4dd5e74d92718 (diff)
Add qmlClearRegisteredTypes Function
Registered types are stored in a global static variable, not on an engine instance. For applications managing multiple engines over their lifetime, there needs to be a way to clear the existing types so they can register new ones and avoid memory leaks. Task-Number: QTBUG-28572 Change-Id: Ic70a4dd1e29d99399b21fb42eaf10d4a52bf2adf Reviewed-by: Christopher Adams <chris.adams@jollamobile.com>
Diffstat (limited to 'src/qml/qml/qqmlimport.cpp')
-rw-r--r--src/qml/qml/qqmlimport.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/qml/qml/qqmlimport.cpp b/src/qml/qml/qqmlimport.cpp
index f793ca9604..2fbb614605 100644
--- a/src/qml/qml/qqmlimport.cpp
+++ b/src/qml/qml/qqmlimport.cpp
@@ -163,6 +163,14 @@ QQmlType *getTypeForUrl(const QString &urlString, const QHashedStringRef& typeNa
typedef QMap<QString, QString> StringStringMap;
Q_GLOBAL_STATIC(StringStringMap, qmlEnginePluginsWithRegisteredTypes); // stores the uri
+void qmlClearEnginePlugins()
+{
+ foreach (const QString &s, qmlEnginePluginsWithRegisteredTypes()->values()) {
+ QPluginLoader loader(s);
+ loader.unload(); // ### Always returns false, worth doing?
+ }
+ qmlEnginePluginsWithRegisteredTypes()->clear();
+}
class QQmlImportNamespace
{