diff options
author | J-P Nurmi <jpnurmi@qt.io> | 2017-10-10 10:57:33 +0200 |
---|---|---|
committer | J-P Nurmi <jpnurmi@qt.io> | 2017-10-10 09:21:30 +0000 |
commit | 8625b79f606fc4e9cbfeed46d9c83bc691aa7464 (patch) | |
tree | b26605b79431fe46d8163623e873cf5cc4990d2b | |
parent | 45c00f8065343ebcf89e14e97e4bb59dad48a7bd (diff) |
Fix the QML context of popup background dimmers
We were accidentally passing QQuickOverlay as a QML context parent for
dynamically created popup background dimmers. There is only one overlay
per window, and the overlay is not destroyed when a popup is destroyed.
QQuickOverlay is just a visual parent item for popup background dimmers,
but the actual owner is QQuickPopup. Make sure to pass the popup instance
as a QML context parent to ensure that the popup background dimmer's QML
context is cleaned up when the popup is destroyed.
Task-number: QTBUG-63672
Change-Id: I5cabbcef5035cef40af3c9edbcd8f7ae3157bd8a
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
-rw-r--r-- | src/quicktemplates2/qquickoverlay.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/quicktemplates2/qquickoverlay.cpp b/src/quicktemplates2/qquickoverlay.cpp index a1d82de0..f30f6a5e 100644 --- a/src/quicktemplates2/qquickoverlay.cpp +++ b/src/quicktemplates2/qquickoverlay.cpp @@ -79,8 +79,8 @@ static QQuickItem *createDimmer(QQmlComponent *component, QQuickPopup *popup, QQ if (component) { QQmlContext *creationContext = component->creationContext(); if (!creationContext) - creationContext = qmlContext(parent); - QQmlContext *context = new QQmlContext(creationContext, parent); + creationContext = qmlContext(popup); + QQmlContext *context = new QQmlContext(creationContext, popup); context->setContextObject(popup); item = qobject_cast<QQuickItem*>(component->beginCreate(context)); } |