From 187af5c7d2aab87545788f59eb8f8549e130c211 Mon Sep 17 00:00:00 2001 From: Lars Knoll Date: Wed, 17 Jan 2018 11:37:14 +0100 Subject: Partially revert "Optimizations for Repeater::clear() and ~QQmlItem()" Reversing the destruction order in ~QQuickItem, and searching from the back in removeChild() wasn't such a good idea after all, as it breaks some assumptions people have about removing. We'll need to find a different solution for the quadratic behaviour coming from QQuickRepeater::clear(). This reverts parts of commit 52874a0e6f739ce410c8401e19b0a9ef6d02cabf. Change-Id: I5a6ff9f5ddd9f0f6667142dbcc568b6aba6f8ee9 Reviewed-by: Simon Hausmann --- src/quick/items/qquickitem.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/quick/items/qquickitem.cpp b/src/quick/items/qquickitem.cpp index 54cb8be5da..af60ab879b 100644 --- a/src/quick/items/qquickitem.cpp +++ b/src/quick/items/qquickitem.cpp @@ -2375,8 +2375,9 @@ QQuickItem::~QQuickItem() else if (d->window) d->derefWindow(); + // XXX todo - optimize while (!d->childItems.isEmpty()) - d->childItems.constLast()->setParentItem(0); + d->childItems.constFirst()->setParentItem(0); if (!d->changeListeners.isEmpty()) { const auto listeners = d->changeListeners; // NOTE: intentional copy (QTBUG-54732) @@ -2952,8 +2953,7 @@ void QQuickItemPrivate::removeChild(QQuickItem *child) Q_ASSERT(child); Q_ASSERT(childItems.contains(child)); - int idx = childItems.lastIndexOf(child); - childItems.removeAt(idx); + childItems.removeOne(child); Q_ASSERT(!childItems.contains(child)); QQuickItemPrivate *childPrivate = QQuickItemPrivate::get(child); -- cgit v1.2.3