From 5445fcac36d7122d533a2bdf0fcfe6206b7f3ff4 Mon Sep 17 00:00:00 2001 From: Richard Moe Gustavsen Date: Wed, 12 Feb 2020 09:21:50 +0100 Subject: QQuickItemView: do not set parent to nullptr upon destruction Setting a delegate item's parent to nullptr will make any bindings to the parent inside the item invalid, and warnings will as such be printed (first seen after 8c72e634b3b0eacbfdee883bfc34994d3c19ed77). I assume the reason for setting the (visual) parent to nullptr is to immediately hide it. So to avoid trigger any bindings, we instead just cull if from the scene graph. It's also dubious why a delegate should have bindings to its parent in the first place, since what ends up being the parent is an implementation detail, and probably not be the item the user expects it to be. Fixes: QTBUG-81976 Change-Id: I7bd8ab91461504b6e79d4aa2ab832be087245c3e Reviewed-by: Mitch Curtis --- src/quick/items/qquickitemview.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/quick/items/qquickitemview.cpp b/src/quick/items/qquickitemview.cpp index 7fb392233e..3e3a2c262b 100644 --- a/src/quick/items/qquickitemview.cpp +++ b/src/quick/items/qquickitemview.cpp @@ -2419,7 +2419,7 @@ void QQuickItemView::destroyingItem(QObject *object) Q_D(QQuickItemView); QQuickItem* item = qmlobject_cast(object); if (item) { - item->setParentItem(nullptr); + QQuickItemPrivate::get(item)->setCulled(true); d->unrequestedItems.remove(item); } } -- cgit v1.2.3