diff options
author | Simon Hausmann <simon.hausmann@qt.io> | 2016-08-01 13:39:37 +0200 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@qt.io> | 2016-08-19 16:55:19 +0000 |
commit | 23527754d60780ac4830f1acd6a54d3487a2c362 (patch) | |
tree | 7daf6c508f8e65e8426e35dc9ca2adc9af9c7b5e /src/imports/qtquick2 | |
parent | bf3b596066af733c04b5ed3ef2dc9ec753a41e79 (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.
Change-Id: Id778890bcd3f1fab16eb312a01de7d423ea3aa22
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Diffstat (limited to 'src/imports/qtquick2')
-rw-r--r-- | src/imports/qtquick2/plugin.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/imports/qtquick2/plugin.cpp b/src/imports/qtquick2/plugin.cpp index e56027c1bb..d16467a5bb 100644 --- a/src/imports/qtquick2/plugin.cpp +++ b/src/imports/qtquick2/plugin.cpp @@ -61,13 +61,17 @@ public: { Q_ASSERT(QLatin1String(uri) == QLatin1String("QtQuick")); Q_UNUSED(uri); + moduleDefined = true; QQmlQtQuick2Module::defineModule(); } ~QtQuick2Plugin() { - QQmlQtQuick2Module::undefineModule(); + if (moduleDefined) + QQmlQtQuick2Module::undefineModule(); } + + bool moduleDefined = false; }; //![class decl] |