Don't update dependent anchors on destruction unless required.
authorMichael Brasser <michael.brasser@nokia.com>
Wed, 30 Nov 2011 06:03:10 +0000 (16:03 +1000)
committerQt by Nokia <qt-info@nokia.com>
Thu, 1 Dec 2011 01:40:06 +0000 (02:40 +0100)
Change-Id: Ic088e800d5bbad0a819824a21b4c0bf430126786
Reviewed-by: Martin Jones <martin.jones@nokia.com>
src/declarative/items/qquickitem.cpp

index 161404f..9c11196 100644 (file)
@@ -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();
     }