Fixed crash in QDeclarativeGridView
authorMartin Jones <martin.jones@nokia.com>
Mon, 23 Jan 2012 03:58:22 +0000 (13:58 +1000)
committerQt by Nokia <qt-info@nokia.com>
Tue, 24 Jan 2012 22:18:10 +0000 (23:18 +0100)
Inserting new items used a different threshold than removing items
outside the view in refill.

Change-Id: I3712837820a1e1a6af280d33d29bd9e01e559691
Reviewed-by: Bea Lam <bea.lam@nokia.com>
src/quick/items/qquickgridview.cpp

index 1335715..594bbce 100644 (file)
@@ -1863,7 +1863,7 @@ bool QQuickGridViewPrivate::applyInsertionChange(const QDeclarativeChangeSet::In
     } else {
         int i = 0;
         int to = buffer+tempPos+size()-1;
-        while (i < count && rowPos <= to + rowSize()*(columns - (colPos/colSize()))/qreal(columns)) {
+        while (i < count && rowPos <= to + rowSize()*(columns - colNum)/qreal(columns+1)) {
             FxViewItem *item = 0;
             if (change.isMove() && (item = currentChanges.removedItems.take(change.moveKey(modelIndex + i))))
                 item->index = modelIndex + i;