aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorUlf Hermann <ulf.hermann@qt.io>2019-10-31 10:22:12 +0100
committerUlf Hermann <ulf.hermann@qt.io>2019-10-31 11:56:13 +0100
commit15d1b173d030f5ae5ca72f511d33c80979503268 (patch)
tree84da24ee744ce086a6c90a02bd46e8af1304d610
parentbcbc3c9cec1f7d7bb8c9d5f5ea94eb5c81ec2853 (diff)
QQuickItem::setParentItem: Check for d->window after deref'ing it
The window may have been deleted. In that case there is nothing to do. Amends commit 73ad6e87bbeceea5830ab3a6b3dc66fa99e30f45. Change-Id: Ib591f34b51f58d49ed0b065be7025f8e54777c10 Reviewed-by: Liang Qi <liang.qi@qt.io>
-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 26f02aeed7..d90cc71997 100644
--- a/src/quick/items/qquickitem.cpp
+++ b/src/quick/items/qquickitem.cpp
@@ -2764,7 +2764,8 @@ void QQuickItem::setParentItem(QQuickItem *parentItem)
// as we potentially changed d->parentWindow above
// the check in derefWindow could not work
// thus, we redo it here with the old parent
- if (!oldParentItem) {
+ // Also, the window may have been deleted by derefWindow()
+ if (!oldParentItem && d->window) {
QQuickWindowPrivate::get(d->window)->parentlessItems.remove(this);
}
}