]> cloud.milkyroute.net Git - dolphin.git/blobdiff - src/kitemviews/kitemlistview.cpp
Merge remote-tracking branch 'origin/KDE/4.11'
[dolphin.git] / src / kitemviews / kitemlistview.cpp
index 80a4ba7e3a26b8457c213dbddbc80b911e40611f..d8edcfc50ac0a2a54314565ca502d2c2ceaa0e39 100644 (file)
@@ -1244,8 +1244,10 @@ void KItemListView::slotGroupedSortingChanged(bool current)
     if (m_grouped) {
         updateGroupHeaderHeight();
     } else {
-        // Clear all visible headers
-        QMutableHashIterator<KItemListWidget*, KItemListGroupHeader*> it (m_visibleGroups);
+        // Clear all visible headers. Note that the QHashIterator takes a copy of
+        // m_visibleGroups. Therefore, it remains valid even if items are removed
+        // from m_visibleGroups in recycleGroupHeaderForWidget().
+        QHashIterator<KItemListWidget*, KItemListGroupHeader*> it(m_visibleGroups);
         while (it.hasNext()) {
             it.next();
             recycleGroupHeaderForWidget(it.key());