Ensure view delegates are object parented to the contentItem
authorMartin Jones <martin.jones@nokia.com>
Thu, 6 Oct 2011 06:52:47 +0000 (16:52 +1000)
committerQt by Nokia <qt-info@nokia.com>
Thu, 6 Oct 2011 08:44:27 +0000 (10:44 +0200)
Caused a leak which resulted in persistent v8 handles not being
disposed.

Change-Id: I5c10ff619531976ab61d9ce1ff8327c4a40cfd5e
Reviewed-on: http://codereview.qt-project.org/6112
Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: Chris Adams <christopher.adams@nokia.com>
src/declarative/items/qsgitemview.cpp

index 3224e32..b34ed82 100644 (file)
@@ -1578,9 +1578,11 @@ FxViewItem *QSGItemViewPrivate::createItem(int modelIndex)
             if (model->completePending()) {
                 // complete
                 viewItem->item->setZ(1);
+                QDeclarative_setParent_noEvent(viewItem->item, q->contentItem());
                 viewItem->item->setParentItem(q->contentItem());
                 model->completeItem();
             } else {
+                QDeclarative_setParent_noEvent(viewItem->item, q->contentItem());
                 viewItem->item->setParentItem(q->contentItem());
             }
             // do other set up for the new item that should not happen