diff options
author | J-P Nurmi <jpnurmi@qt.io> | 2016-08-23 16:12:50 +0200 |
---|---|---|
committer | J-P Nurmi <jpnurmi@qt.io> | 2016-08-23 15:53:22 +0000 |
commit | 2b91e5392105d4d1ea85397e6db4ab831cc8737e (patch) | |
tree | f195db34d9e3671aa06f89961c03082768ad7241 /src/quickcontrols2/qquickstyleplugin.cpp | |
parent | 53c780f15c2d170514f74d949a8165033275bddd (diff) |
QQuickStylePlugin: avoid re-creating the proxy theme
QQuickStylePlugin::initializeEngine() is called multiple times due to
multiple QQmlEngine instances (like in qml2puppet). Don't attempt to
re-create the proxy theme on the second round. Thanks to QScopedPointer,
the old proxy theme instance was automatically destroyed and thus, the
new proxy theme crashed.
Task-number: QTBUG-54995
Change-Id: I1648c789df062fdfda54302c77f471139a8de88f
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Diffstat (limited to 'src/quickcontrols2/qquickstyleplugin.cpp')
-rw-r--r-- | src/quickcontrols2/qquickstyleplugin.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/quickcontrols2/qquickstyleplugin.cpp b/src/quickcontrols2/qquickstyleplugin.cpp index 7f6e1323..3a4a0952 100644 --- a/src/quickcontrols2/qquickstyleplugin.cpp +++ b/src/quickcontrols2/qquickstyleplugin.cpp @@ -60,6 +60,11 @@ void QQuickStylePlugin::initializeEngine(QQmlEngine *engine, const char *uri) Q_UNUSED(engine); Q_UNUSED(uri); + // make sure not to re-create the proxy theme if initializeEngine() + // is called multiple times, like in case of qml2puppet (QTBUG-54995) + if (!m_theme.isNull()) + return; + const QString style = name(); if (!style.isEmpty() && style.compare(QQuickStyle::name(), Qt::CaseInsensitive) == 0) { m_theme.reset(createTheme()); |