summaryrefslogtreecommitdiffstats
path: root/src/quick/items/qquickitem.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/quick/items/qquickitem.cpp')
-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 0e035af9a6..4c20b7e2e1 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);
}
}