[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    kdevelop/parts/classview
From:       Jens Dagerbo <jens.dagerbo () swipnet ! se>
Date:       2004-12-04 14:50:07
Message-ID: 20041204145007.03EA11B904 () office ! kde ! org
[Download RAW message or body]

CVS commit by dagerbo: 

Don't increment an iterator pointing to a removed node in a QMap.  


  M +22 -14    navigator.cpp   1.6


--- kdevelop/parts/classview/navigator.cpp  #1.5:1.6
@@ -246,12 +246,16 @@ void Navigator::refreshNavBars(const QSt
 
     //remove items not in toLeave list
-    for (QMap<QString, QListViewItem*>::iterator it = m_functionNavDecls.begin();
-        it != m_functionNavDecls.end(); ++it)
+    QMap<QString, QListViewItem*>::iterator it = m_functionNavDecls.begin();
+    while ( it != m_functionNavDecls.end() )
     {
-        if (!toLeave.contains(it.key()))
+        QMap<QString, QListViewItem*>::iterator it2 = it;     
+        ++it;
+        if ( !toLeave.contains( it2.key() ) )
         {
-            if (it.data())
-                m_part->m_functionsnav->view()->removeItem(it.data());
-            m_functionNavDecls.remove(it);
+            if (it2.data())
+            {
+                m_part->m_functionsnav->view()->removeItem(it2.data());
+            }
+            m_functionNavDecls.remove(it2);        
         }
     }
@@ -283,12 +287,16 @@ void Navigator::refreshNavBars(const QSt
     kdDebug(9003) << k_funcinfo << "leave list: " << toLeave << endl;
     //remove items not in toLeave list
-    for (QMap<QString, QListViewItem*>::iterator it = m_functionNavDefs.begin();
-        it != m_functionNavDefs.end(); ++it)
+    QMap<QString, QListViewItem*>::iterator itt = m_functionNavDefs.begin();
+    while ( itt != m_functionNavDefs.end() )
     {
-        if (!toLeave.contains(it.key()))
+        QMap<QString, QListViewItem*>::iterator it2 = itt;     
+        ++itt;
+        if ( !toLeave.contains( it2.key() ) )
         {
-            if (it.data())
-                m_part->m_functionsnav->view()->removeItem(it.data());
-            m_functionNavDefs.remove(it);
+            if (it2.data())
+            {
+                m_part->m_functionsnav->view()->removeItem(it2.data());
+            }
+            m_functionNavDefs.remove(it2);        
         }
     }


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic