diff options
author | Sami Merila <sami.merila@nokia.com> | 2010-10-22 07:29:28 (GMT) |
---|---|---|
committer | Sami Merila <sami.merila@nokia.com> | 2010-10-22 07:29:28 (GMT) |
commit | e853b240e1b974067aa1bc377c0ae01a60e9c274 (patch) | |
tree | 0adb9e777bb11d5e04dea2016b0a1632afd28510 /src/gui | |
parent | 80d7253b5881ed7f1e2a175c66f1f3ed57773227 (diff) | |
parent | db08a136e5999a82869269af09323222ff2c6e1d (diff) | |
download | Qt-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.cpp | 13 |
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); |