summaryrefslogtreecommitdiffstats
path: root/src/gui/itemviews
diff options
context:
space:
mode:
authorGabriel de Dietrich <gabriel.dietrich-de@nokia.com>2009-11-26 11:41:58 (GMT)
committerGabriel de Dietrich <gabriel.dietrich-de@nokia.com>2009-11-26 15:24:05 (GMT)
commite8d7d2172627dd3cac8b0cc3165ed371b524feb4 (patch)
treeef5f02e12ba9f301fafd489d3157d96f1ad6c6cb /src/gui/itemviews
parent88b9c6eb3f1dde9997d5e824450c9eaa2a36f8d5 (diff)
downloadQt-e8d7d2172627dd3cac8b0cc3165ed371b524feb4.zip
Qt-e8d7d2172627dd3cac8b0cc3165ed371b524feb4.tar.gz
Qt-e8d7d2172627dd3cac8b0cc3165ed371b524feb4.tar.bz2
QSortProxyModel: Crash when changing model with 2-level proxy and selected items
The index mapping to the base model was being cleared before the persistant model indices. Reviewed-by: Olivier Task-number: QTBUG-6237
Diffstat (limited to 'src/gui/itemviews')
-rw-r--r--src/gui/itemviews/qsortfilterproxymodel.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/gui/itemviews/qsortfilterproxymodel.cpp b/src/gui/itemviews/qsortfilterproxymodel.cpp
index f1ae3d2..fc82f30 100644
--- a/src/gui/itemviews/qsortfilterproxymodel.cpp
+++ b/src/gui/itemviews/qsortfilterproxymodel.cpp
@@ -1153,6 +1153,8 @@ void QSortFilterProxyModelPrivate::_q_sourceAboutToBeReset()
{
Q_Q(QSortFilterProxyModel);
q->beginResetModel();
+ invalidatePersistentIndexes();
+ clear_mapping();
}
void QSortFilterProxyModelPrivate::_q_sourceReset()
@@ -1470,6 +1472,8 @@ void QSortFilterProxyModel::setSourceModel(QAbstractItemModel *sourceModel)
{
Q_D(QSortFilterProxyModel);
+ beginResetModel();
+
disconnect(d->model, SIGNAL(dataChanged(QModelIndex,QModelIndex)),
this, SLOT(_q_sourceDataChanged(QModelIndex,QModelIndex)));
@@ -1551,7 +1555,7 @@ void QSortFilterProxyModel::setSourceModel(QAbstractItemModel *sourceModel)
connect(d->model, SIGNAL(modelReset()), this, SLOT(_q_sourceReset()));
d->clear_mapping();
- reset();
+ endResetModel();
if (d->update_source_sort_column() && d->dynamic_sortfilter)
d->sort();
}