summaryrefslogtreecommitdiffstats
path: root/src/gui/itemviews
diff options
context:
space:
mode:
authorOlivier Goffart <ogoffart@trolltech.com>2009-04-16 08:40:11 (GMT)
committerOlivier Goffart <ogoffart@trolltech.com>2009-04-16 10:48:00 (GMT)
commitf8fba0d48a1f30540ddf15f0d36f415b192d1d8b (patch)
treee001d3557b4f9db0cafcb7141c0555f3961cd58f /src/gui/itemviews
parentc2f89fd0d9d13a0da1ecc33414860795721261a7 (diff)
downloadQt-f8fba0d48a1f30540ddf15f0d36f415b192d1d8b.zip
Qt-f8fba0d48a1f30540ddf15f0d36f415b192d1d8b.tar.gz
Qt-f8fba0d48a1f30540ddf15f0d36f415b192d1d8b.tar.bz2
Fix crash in the SQLQueryModel tests
Amend fd5f83e612729cebc5395c992bd98628bb9ea25f calling fetchMore in create_mapping was a bad idea bacause it may lead to infinite recurtion Make a special case for hasChildren instead Task-number: 250023 Reviewed-by: Marius Bugge Monsen BT: yes
Diffstat (limited to 'src/gui/itemviews')
-rw-r--r--src/gui/itemviews/qsortfilterproxymodel.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/gui/itemviews/qsortfilterproxymodel.cpp b/src/gui/itemviews/qsortfilterproxymodel.cpp
index b0137d2..2c9eeea 100644
--- a/src/gui/itemviews/qsortfilterproxymodel.cpp
+++ b/src/gui/itemviews/qsortfilterproxymodel.cpp
@@ -274,9 +274,6 @@ IndexMap::const_iterator QSortFilterProxyModelPrivate::create_mapping(
Mapping *m = new Mapping;
- if (model->canFetchMore(source_parent))
- model->fetchMore(source_parent);
-
int source_rows = model->rowCount(source_parent);
for (int i = 0; i < source_rows; ++i) {
if (q->filterAcceptsRow(i, source_parent))
@@ -1572,6 +1569,10 @@ bool QSortFilterProxyModel::hasChildren(const QModelIndex &parent) const
return false;
if (!d->model->hasChildren(source_parent))
return false;
+
+ if (d->model->canFetchMore(source_parent))
+ return true; //we assume we might have children that can be fetched
+
QSortFilterProxyModelPrivate::Mapping *m = d->create_mapping(source_parent).value();
return m->source_rows.count() != 0 && m->source_columns.count() != 0;
}