summaryrefslogtreecommitdiffstats
path: root/src/gui
diff options
context:
space:
mode:
authorSami Merila <sami.merila@nokia.com>2010-10-22 07:29:28 (GMT)
committerSami Merila <sami.merila@nokia.com>2010-10-22 07:29:28 (GMT)
commite853b240e1b974067aa1bc377c0ae01a60e9c274 (patch)
tree0adb9e777bb11d5e04dea2016b0a1632afd28510 /src/gui
parent80d7253b5881ed7f1e2a175c66f1f3ed57773227 (diff)
parentdb08a136e5999a82869269af09323222ff2c6e1d (diff)
downloadQt-e853b240e1b974067aa1bc377c0ae01a60e9c274.zip
Qt-e853b240e1b974067aa1bc377c0ae01a60e9c274.tar.gz
Qt-e853b240e1b974067aa1bc377c0ae01a60e9c274.tar.bz2
Merge branch '4.7' of git@scm.dev.nokia.troll.no:qt/qt-s60-public into 4.7
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/itemviews/qitemselectionmodel.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/gui/itemviews/qitemselectionmodel.cpp b/src/gui/itemviews/qitemselectionmodel.cpp
index f848321..e69cd65 100644
--- a/src/gui/itemviews/qitemselectionmodel.cpp
+++ b/src/gui/itemviews/qitemselectionmodel.cpp
@@ -1059,6 +1059,19 @@ void QItemSelectionModel::select(const QItemSelection &selection, QItemSelection
// store old selection
QItemSelection sel = selection;
+ // If d->ranges is non-empty when the source model is reset the persistent indexes
+ // it contains will be invalid. We can't clear them in a modelReset slot because that might already
+ // be too late if another model observer is connected to the same modelReset slot and is invoked first
+ // it might call select() on this selection model before any such QItemSelectionModelPrivate::_q_modelReset() slot
+ // is invoked, so it would not be cleared yet. We clear it invalid ranges in it here.
+ QItemSelection::iterator it = d->ranges.begin();
+ while (it != d->ranges.end()) {
+ if (!it->isValid())
+ it = d->ranges.erase(it);
+ else
+ ++it;
+ }
+
QItemSelection old = d->ranges;
old.merge(d->currentSelection, d->currentCommand);