summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@qt.io>2016-08-01 13:39:37 +0200
committerSimon Hausmann <simon.hausmann@qt.io>2016-08-25 16:02:18 +0000
commitec73b9ff3b0064cf7760baeb826d912d9a30d227 (patch)
treeff2fd64eba4cda74e3ea9cde6f2e84d0168c3a17 /src
parent47e1c277c3ca375caa6598703b74aa312b85b60d (diff)
Fix crash in tst_qqmlextensionplugin on shutdown
On shutdown the test will unload all the plugins it loaded. In the case of the QtQuick2 plugin we only loaded it but never called registerTypes, as the test merely sees if the plugin can be instantiated. Consequently the attempt at unregistering the value type providers will fail because it was previously never defined. Note: We can't just let the QQmlValueTypeProvider destructor take care of the deregistration, as we do not truly unload plugins anymore (thankfully). However the plugin object will be destroyed and along with it we should correctly de-register the things we registered earlier, otherwise when initializing the plugin again, we'll register handers multiple times. Task-number: QTBUG-55524 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io> (cherry picked from commit 23527754d60780ac4830f1acd6a54d3487a2c362) Change-Id: I52c9e4c33649966c6291fafaa2efc4242ada6788
Diffstat (limited to 'src')
-rw-r--r--src/imports/qtquick2/plugin.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/imports/qtquick2/plugin.cpp b/src/imports/qtquick2/plugin.cpp
index b4caf01d10..71e2fa7ec0 100644
--- a/src/imports/qtquick2/plugin.cpp
+++ b/src/imports/qtquick2/plugin.cpp
@@ -43,17 +43,22 @@ class QtQuick2Plugin : public QQmlExtensionPlugin
Q_OBJECT
Q_PLUGIN_METADATA(IID QQmlExtensionInterface_iid)
public:
+ QtQuick2Plugin() : moduleDefined(false) {}
virtual void registerTypes(const char *uri)
{
Q_ASSERT(QLatin1String(uri) == QLatin1String("QtQuick"));
Q_UNUSED(uri);
+ moduleDefined = true;
QQmlQtQuick2Module::defineModule();
}
~QtQuick2Plugin()
{
- QQmlQtQuick2Module::undefineModule();
+ if (moduleDefined)
+ QQmlQtQuick2Module::undefineModule();
}
+
+ bool moduleDefined;
};
//![class decl]