aboutsummaryrefslogtreecommitdiffstats
path: root/src/declarative/items/qsggridview.cpp
diff options
context:
space:
mode:
authorMartin Jones <martin.jones@nokia.com>2011-08-02 13:58:49 +1000
committerQt by Nokia <qt-info@nokia.com>2011-08-02 08:50:21 +0200
commit94b44b19edbb501d4cbe7519fb7202ead81746cc (patch)
treeb9bd8b0f3a998ce1e7557685eaa9feb574c6660e /src/declarative/items/qsggridview.cpp
parent1b65161042108ee46ca42331dacc2b66b63c6b4e (diff)
Views with no delegate crash when items are inserted.
Check that we have a valid VisualModel before reacting to model changes. Change-Id: I6107e8fb8942a3625e501ab549a337f1affd4fbd Fixes: QTBUG-20640 Reviewed-on: http://codereview.qt.nokia.com/2481 Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com> Reviewed-by: Bea Lam <bea.lam@nokia.com>
Diffstat (limited to 'src/declarative/items/qsggridview.cpp')
-rw-r--r--src/declarative/items/qsggridview.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/declarative/items/qsggridview.cpp b/src/declarative/items/qsggridview.cpp
index ec22761406..ac86ebbb7f 100644
--- a/src/declarative/items/qsggridview.cpp
+++ b/src/declarative/items/qsggridview.cpp
@@ -1280,7 +1280,7 @@ void QSGGridView::moveCurrentIndexRight()
void QSGGridView::itemsInserted(int modelIndex, int count)
{
Q_D(QSGGridView);
- if (!isComponentComplete())
+ if (!isComponentComplete() || !d->model || !d->model->isValid())
return;
int index = d->visibleItems.count() ? d->mapFromModel(modelIndex) : 0;
@@ -1411,7 +1411,7 @@ void QSGGridView::itemsInserted(int modelIndex, int count)
void QSGGridView::itemsRemoved(int modelIndex, int count)
{
Q_D(QSGGridView);
- if (!isComponentComplete())
+ if (!isComponentComplete() || !d->model || !d->model->isValid())
return;
d->itemCount -= count;
@@ -1493,7 +1493,7 @@ void QSGGridView::itemsRemoved(int modelIndex, int count)
void QSGGridView::itemsMoved(int from, int to, int count)
{
Q_D(QSGGridView);
- if (!isComponentComplete())
+ if (!isComponentComplete() || !d->isValid())
return;
d->updateUnrequestedIndexes();