summaryrefslogtreecommitdiffstats
path: root/src/declarative/graphicsitems/qdeclarativegridview.cpp
diff options
context:
space:
mode:
authorMartin Jones <martin.jones@nokia.com>2010-02-24 07:48:20 (GMT)
committerMartin Jones <martin.jones@nokia.com>2010-02-24 07:48:20 (GMT)
commitd3a0bd57c7c3cecdeeb4ad9af3cf6bb4ee39964b (patch)
treeef5fd503f73819932ce1a240bd5ccfd287873edb /src/declarative/graphicsitems/qdeclarativegridview.cpp
parent40256d682e1a552c9566a744a66cc6fe008b578b (diff)
downloadQt-d3a0bd57c7c3cecdeeb4ad9af3cf6bb4ee39964b.zip
Qt-d3a0bd57c7c3cecdeeb4ad9af3cf6bb4ee39964b.tar.gz
Qt-d3a0bd57c7c3cecdeeb4ad9af3cf6bb4ee39964b.tar.bz2
Don't crash if the currentIndex is set while creating a delegate.
Task-number: QTBUG-8456
Diffstat (limited to 'src/declarative/graphicsitems/qdeclarativegridview.cpp')
-rw-r--r--src/declarative/graphicsitems/qdeclarativegridview.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/declarative/graphicsitems/qdeclarativegridview.cpp b/src/declarative/graphicsitems/qdeclarativegridview.cpp
index aae5571..2ef6305 100644
--- a/src/declarative/graphicsitems/qdeclarativegridview.cpp
+++ b/src/declarative/graphicsitems/qdeclarativegridview.cpp
@@ -321,7 +321,7 @@ FxGridItem *QDeclarativeGridViewPrivate::createItem(int modelIndex)
listItem->item->setParent(q->viewport());
unrequestedItems.remove(listItem->item);
}
- requestedIndex = 0;
+ requestedIndex = -1;
return listItem;
}
@@ -888,6 +888,8 @@ int QDeclarativeGridView::currentIndex() const
void QDeclarativeGridView::setCurrentIndex(int index)
{
Q_D(QDeclarativeGridView);
+ if (d->requestedIndex >= 0) // currently creating item
+ return;
if (isComponentComplete() && d->isValid() && index != d->currentIndex && index < d->model->count() && index >= 0) {
d->moveReason = QDeclarativeGridViewPrivate::SetIndex;
cancelFlick();