aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorChris Adams <chris.adams@jollamobile.com>2014-12-01 14:32:57 +1000
committerChristopher Adams <chris.adams@jollamobile.com>2014-12-04 04:04:20 +0100
commitb60bedf42ce7714180ced5597e8849b66a4d942b (patch)
treeb2c64e22e8d92594cad9044a98d8a37e6239231d /src
parent43c93a55e28a4655d8bc8d49a81b7802d7157244 (diff)
Fix QtQuick2 module unload support
This commit ensures that the value type providers installed by the QtQuick2 QML module during initialization are uninstalled when the plugin is unloaded. It also fixes a bug in the type compiler so that it now works with types from plugins which get unloaded and then reloaded. Task-number: QTBUG-43004 Change-Id: I4b3fb75aae65dfbc5de9c88701ed82514087ab7d Reviewed-by: Matthew Vogt <matthew.vogt@qinetic.com.au>
Diffstat (limited to 'src')
-rw-r--r--src/imports/qtquick2/plugin.cpp5
-rw-r--r--src/qml/compiler/qqmltypecompiler.cpp2
-rw-r--r--src/quick/qtquick2.cpp5
-rw-r--r--src/quick/qtquick2_p.h1
-rw-r--r--src/quick/qtquickglobal_p.h1
-rw-r--r--src/quick/util/qquickglobal.cpp7
6 files changed, 20 insertions, 1 deletions
diff --git a/src/imports/qtquick2/plugin.cpp b/src/imports/qtquick2/plugin.cpp
index d5096fc6e8..ad3db2290f 100644
--- a/src/imports/qtquick2/plugin.cpp
+++ b/src/imports/qtquick2/plugin.cpp
@@ -49,6 +49,11 @@ public:
Q_UNUSED(uri);
QQmlQtQuick2Module::defineModule();
}
+
+ ~QtQuick2Plugin()
+ {
+ QQmlQtQuick2Module::undefineModule();
+ }
};
//![class decl]
diff --git a/src/qml/compiler/qqmltypecompiler.cpp b/src/qml/compiler/qqmltypecompiler.cpp
index 3a27a859fd..8edf4bbe7c 100644
--- a/src/qml/compiler/qqmltypecompiler.cpp
+++ b/src/qml/compiler/qqmltypecompiler.cpp
@@ -1389,7 +1389,7 @@ void QQmlComponentAndAliasResolver::findAndRegisterImplicitComponents(const QmlI
if (!mo)
continue;
- static QQmlType *componentType = QQmlMetaType::qmlType(&QQmlComponent::staticMetaObject);
+ QQmlType *componentType = QQmlMetaType::qmlType(&QQmlComponent::staticMetaObject);
Q_ASSERT(componentType);
QmlIR::Object *syntheticComponent = pool->New<QmlIR::Object>();
diff --git a/src/quick/qtquick2.cpp b/src/quick/qtquick2.cpp
index 6acff85961..09784d161a 100644
--- a/src/quick/qtquick2.cpp
+++ b/src/quick/qtquick2.cpp
@@ -194,5 +194,10 @@ void QQmlQtQuick2Module::defineModule()
}
}
+void QQmlQtQuick2Module::undefineModule()
+{
+ QQuick_deinitializeProviders();
+}
+
QT_END_NAMESPACE
diff --git a/src/quick/qtquick2_p.h b/src/quick/qtquick2_p.h
index 2847d5d3ff..8f415cbd02 100644
--- a/src/quick/qtquick2_p.h
+++ b/src/quick/qtquick2_p.h
@@ -42,6 +42,7 @@ class Q_QUICK_PRIVATE_EXPORT QQmlQtQuick2Module
{
public:
static void defineModule();
+ static void undefineModule();
};
QT_END_NAMESPACE
diff --git a/src/quick/qtquickglobal_p.h b/src/quick/qtquickglobal_p.h
index e2bf198b1c..7fe09da92e 100644
--- a/src/quick/qtquickglobal_p.h
+++ b/src/quick/qtquickglobal_p.h
@@ -54,6 +54,7 @@
QT_BEGIN_NAMESPACE
void QQuick_initializeProviders();
+void QQuick_deinitializeProviders();
Q_DECLARE_LOGGING_CATEGORY(DBG_TOUCH)
Q_DECLARE_LOGGING_CATEGORY(DBG_MOUSE)
diff --git a/src/quick/util/qquickglobal.cpp b/src/quick/util/qquickglobal.cpp
index 455e180dbe..139bae4038 100644
--- a/src/quick/util/qquickglobal.cpp
+++ b/src/quick/util/qquickglobal.cpp
@@ -982,4 +982,11 @@ void QQuick_initializeProviders()
QQml_setGuiProvider(getGuiProvider());
}
+void QQuick_deinitializeProviders()
+{
+ QQml_removeValueTypeProvider(getValueTypeProvider());
+ QQml_setColorProvider(0); // technically, another plugin may have overridden our providers
+ QQml_setGuiProvider(0); // but we cannot handle that case in a sane way.
+}
+
QT_END_NAMESPACE