mirror of
https://invent.kde.org/system/dolphin
synced 2024-09-20 00:41:23 +00:00
Fix incorrect usage of list iterators
The problem was that we erased an iterator from the list and then incremented it. This can lead to problems (namely, random crashes) if the iterator pointed to the last list element. Thanks to Sandro Mani for testing the patch! BUG: 311246 FIXED-IN: 4.9.5
This commit is contained in:
parent
5343a18b50
commit
6d0f9ada01
|
@ -1227,11 +1227,14 @@ void DolphinView::updateViewState()
|
|||
|
||||
QSet<int> selectedItems = selectionManager->selectedItems();
|
||||
|
||||
for (QList<KUrl>::iterator it = m_selectedUrls.begin(); it != m_selectedUrls.end(); ++it) {
|
||||
QList<KUrl>::iterator it = m_selectedUrls.begin();
|
||||
while (it != m_selectedUrls.end()) {
|
||||
const int index = m_model->index(*it);
|
||||
if (index >= 0) {
|
||||
selectedItems.insert(index);
|
||||
m_selectedUrls.erase(it);
|
||||
it = m_selectedUrls.erase(it);
|
||||
} else {
|
||||
++it;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue