diff options
author | Martin Jones <martin.jones@nokia.com> | 2011-08-02 13:58:49 +1000 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2011-08-02 08:50:21 +0200 |
commit | 94b44b19edbb501d4cbe7519fb7202ead81746cc (patch) | |
tree | b9bd8b0f3a998ce1e7557685eaa9feb574c6660e /src/declarative/items/qsglistview.cpp | |
parent | 1b65161042108ee46ca42331dacc2b66b63c6b4e (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/qsglistview.cpp')
-rw-r--r-- | src/declarative/items/qsglistview.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/declarative/items/qsglistview.cpp b/src/declarative/items/qsglistview.cpp index 15042bea91..d9792d1770 100644 --- a/src/declarative/items/qsglistview.cpp +++ b/src/declarative/items/qsglistview.cpp @@ -1578,7 +1578,7 @@ void QSGListView::updateSections() void QSGListView::itemsInserted(int modelIndex, int count) { Q_D(QSGListView); - if (!isComponentComplete()) + if (!isComponentComplete() || !d->model || !d->model->isValid()) return; d->updateUnrequestedIndexes(); d->moveReason = QSGListViewPrivate::Other; @@ -1718,7 +1718,7 @@ void QSGListView::itemsInserted(int modelIndex, int count) void QSGListView::itemsRemoved(int modelIndex, int count) { Q_D(QSGListView); - if (!isComponentComplete()) + if (!isComponentComplete() || !d->model || !d->model->isValid()) return; d->moveReason = QSGListViewPrivate::Other; d->updateUnrequestedIndexes(); @@ -1815,7 +1815,7 @@ void QSGListView::itemsRemoved(int modelIndex, int count) void QSGListView::itemsMoved(int from, int to, int count) { Q_D(QSGListView); - if (!isComponentComplete()) + if (!isComponentComplete() || !d->isValid()) return; d->updateUnrequestedIndexes(); |