From f304dd6fbb9d901c0a72609dc3c384eab4935f93 Mon Sep 17 00:00:00 2001 From: Michael Brasser Date: Wed, 30 Nov 2011 16:03:10 +1000 Subject: [PATCH] Don't update dependent anchors on destruction unless required. Change-Id: Ic088e800d5bbad0a819824a21b4c0bf430126786 Reviewed-by: Martin Jones --- src/declarative/items/qquickitem.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/declarative/items/qquickitem.cpp b/src/declarative/items/qquickitem.cpp index 161404f..9c11196 100644 --- a/src/declarative/items/qquickitem.cpp +++ b/src/declarative/items/qquickitem.cpp @@ -1755,10 +1755,13 @@ QQuickItem::~QQuickItem() anchor->clearItem(this); } - // XXX todo - the original checks if the parent is being destroyed + /* + update item anchors that depended on us unless they are our child (and will also be destroyed), + or our sibling, and our parent is also being destroyed. + */ for (int ii = 0; ii < d->changeListeners.count(); ++ii) { QQuickAnchorsPrivate *anchor = d->changeListeners.at(ii).listener->anchorPrivate(); - if (anchor && anchor->item && anchor->item->parent() != this) //child will be deleted anyway + if (anchor && anchor->item && anchor->item->parentItem() && anchor->item->parentItem() != this) anchor->update(); } -- 2.7.4