From a54eb316af7921ff77d4419c8b11b31f8e6fac7b Mon Sep 17 00:00:00 2001 From: Andy Shaw Date: Sun, 14 Apr 2019 10:43:57 +0200 Subject: 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 --- src/dialogs/qquickabstractdialog_p.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/dialogs/qquickabstractdialog_p.h') 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; -- cgit v1.2.1