diff options
author | Stephen Kelly <stephen.kelly@kdab.com> | 2012-08-06 15:02:49 (GMT) |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-08-08 11:15:24 (GMT) |
commit | 9338a26614ce6a50a6c1d30e40dfaceacdfd4912 (patch) | |
tree | dfb1b5feed1314de271ed7356735beab24428e03 /src/gui/itemviews | |
parent | ada98493bbfbd9af0d0b593017e29d39bcd3495e (diff) | |
download | Qt-9338a26614ce6a50a6c1d30e40dfaceacdfd4912.zip Qt-9338a26614ce6a50a6c1d30e40dfaceacdfd4912.tar.gz Qt-9338a26614ce6a50a6c1d30e40dfaceacdfd4912.tar.bz2 |
Avoid crashes when invalidating a proxy model filter.
Backport of b84e180263d0da3d1e6967fcf759225a778ea6ea
from qtbase.
Task-number: QTBUG-26107
Change-Id: I8323b19ce7b641165de21ad9a6e6b05bf4d93b1c
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
Diffstat (limited to 'src/gui/itemviews')
-rw-r--r-- | src/gui/itemviews/qsortfilterproxymodel.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/gui/itemviews/qsortfilterproxymodel.cpp b/src/gui/itemviews/qsortfilterproxymodel.cpp index 1426a07..d937b63 100644 --- a/src/gui/itemviews/qsortfilterproxymodel.cpp +++ b/src/gui/itemviews/qsortfilterproxymodel.cpp @@ -1036,12 +1036,13 @@ void QSortFilterProxyModelPrivate::filter_changed(const QModelIndex &source_pare Mapping *m = it.value(); QSet<int> rows_removed = handle_filter_changed(m->proxy_rows, m->source_rows, source_parent, Qt::Vertical); QSet<int> columns_removed = handle_filter_changed(m->proxy_columns, m->source_columns, source_parent, Qt::Horizontal); - QVector<QModelIndex>::iterator it2 = m->mapped_children.end(); - while (it2 != m->mapped_children.begin()) { + QVector<QModelIndex> mappedChildren = m->mapped_children; + QVector<QModelIndex>::iterator it2 = mappedChildren.end(); + while (it2 != mappedChildren.begin()) { --it2; const QModelIndex source_child_index = *it2; if (rows_removed.contains(source_child_index.row()) || columns_removed.contains(source_child_index.column())) { - it2 = m->mapped_children.erase(it2); + it2 = mappedChildren.erase(it2); remove_from_mapping(source_child_index); } else { filter_changed(source_child_index); |