summaryrefslogtreecommitdiffstats
path: root/src
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
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')
-rw-r--r--src/declarative/graphicsitems/qdeclarativegridview.cpp4
-rw-r--r--src/declarative/graphicsitems/qdeclarativelistview.cpp2
2 files changed, 5 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();
diff --git a/src/declarative/graphicsitems/qdeclarativelistview.cpp b/src/declarative/graphicsitems/qdeclarativelistview.cpp
index d471749..77e3a15 100644
--- a/src/declarative/graphicsitems/qdeclarativelistview.cpp
+++ b/src/declarative/graphicsitems/qdeclarativelistview.cpp
@@ -1580,6 +1580,8 @@ int QDeclarativeListView::currentIndex() const
void QDeclarativeListView::setCurrentIndex(int index)
{
Q_D(QDeclarativeListView);
+ if (d->requestedIndex >= 0) // currently creating item
+ return;
if (isComponentComplete() && d->isValid() && index != d->currentIndex && index < d->model->count() && index >= 0) {
d->moveReason = QDeclarativeListViewPrivate::SetIndex;
cancelFlick();