Commit 6d0f9ada authored by Frank Reininghaus's avatar Frank Reininghaus

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
parent 5343a18b
......@@ -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;
}
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment