summaryrefslogtreecommitdiff
path: root/src/dialogs/qquickabstractdialog_p.h
diff options
context:
space:
mode:
authorAndy Shaw <andy.shaw@qt.io>2019-04-14 10:43:57 +0200
committerShawn Rutledge <shawn.rutledge@qt.io>2019-04-16 12:53:29 +0000
commita54eb316af7921ff77d4419c8b11b31f8e6fac7b (patch)
tree59752ad0e9872e2b36cd7be09d8c431d1aa699e8 /src/dialogs/qquickabstractdialog_p.h
parent1edf84eff083eb5412b4c5c7cd3bd8166f15f61f (diff)
downloadqtquickcontrols-a54eb316af7921ff77d4419c8b11b31f8e6fac7b.tar.gz
Create the decoration component when it is needed
If multiple QQmlEngines are created and use a Dialog, initalizeEngine will be called more than once and therefore recreates the QQuickAbstractDialog::m_decorationComponent without deleting the original. Therefore we keep the decoration component url instead, and create the decoration component on demand. This ensures that it keeps the component relevant for the QQmlEngine and stops the memory leak from before as well. Fixes: QTBUG-75149 Change-Id: Ic79103f42d092d39b46868a45b4099ddc6edf9db Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Diffstat (limited to 'src/dialogs/qquickabstractdialog_p.h')
-rw-r--r--src/dialogs/qquickabstractdialog_p.h3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/dialogs/qquickabstractdialog_p.h b/src/dialogs/qquickabstractdialog_p.h
index 54dbaace..a861739b 100644
--- a/src/dialogs/qquickabstractdialog_p.h
+++ b/src/dialogs/qquickabstractdialog_p.h
@@ -167,7 +167,8 @@ protected: // variables and methods for pure-QML implementations only
bool m_visibleChangedConnected;
bool m_dialogHelperInUse;
- static QQmlComponent *m_decorationComponent;
+ QQmlComponent *m_decorationComponent = nullptr;
+ static QUrl m_decorationComponentUrl;
friend class QtQuick2DialogsPlugin;