From 15d1b173d030f5ae5ca72f511d33c80979503268 Mon Sep 17 00:00:00 2001 From: Ulf Hermann Date: Thu, 31 Oct 2019 10:22:12 +0100 Subject: 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 --- src/quick/items/qquickitem.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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); } } -- cgit v1.2.3