summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFabian Kosmale <fabian.kosmale@qt.io>2021-03-31 16:00:38 +0200
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2021-03-31 22:10:52 +0000
commitc92ed2e94c56397426d51c5e6f039099947c1044 (patch)
tree338cbc7e30029831777058417fc17edb1534a2b7
parent04a94d342c08d9945735527f2d78b29dc395fd7d (diff)
QQuickItem: Do not dereference nullptr
During engine shut-down, the delivery agent might already have been deleted, but we still get a call to setEffectiveVisibleRecur. Thus we need to check that the agent is non-null. Change-Id: Ie2d5923d686789c0758913799ff0702a85a55402 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io> (cherry picked from commit f8fc2d11a9cb2c55f4efc4a089663967ff78cc0b) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
-rw-r--r--src/quick/items/qquickitem.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/quick/items/qquickitem.cpp b/src/quick/items/qquickitem.cpp
index cab7364919..82f4fac2bf 100644
--- a/src/quick/items/qquickitem.cpp
+++ b/src/quick/items/qquickitem.cpp
@@ -6177,7 +6177,8 @@ bool QQuickItemPrivate::setEffectiveVisibleRecur(bool newEffectiveVisible)
if (parentItem)
QQuickItemPrivate::get(parentItem)->dirty(ChildrenStackingChanged);
if (window)
- deliveryAgentPrivate()->removeGrabber(q, true, true, true);
+ if (auto agent = deliveryAgentPrivate(); agent)
+ agent->removeGrabber(q, true, true, true);
bool childVisibilityChanged = false;
for (int ii = 0; ii < childItems.count(); ++ii)