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

List:       kde-commits
Subject:    branches/KDE/4.0/kdelibs/kfile
From:       Roman Jarosz <kedgedev () centrum ! cz>
Date:       2008-06-01 16:37:35
Message-ID: 1212338255.001528.20137.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 815384 by rjarosz:

Backport commit 815383.
Can't use the itEnd iterator if we erase item from list, because the iterator is invalid.

CCBUG: 162956



 M  +2 -6      kprotocolcombo.cpp  


--- branches/KDE/4.0/kdelibs/kfile/kprotocolcombo.cpp #815383:815384
@@ -36,15 +36,11 @@
 {
     qSort(m_protocols);
     QStringList::iterator it = m_protocols.begin();
-    QStringList::iterator itEnd = m_protocols.end();
     menu = new QMenu(this);
-    while (it != itEnd) {
+    while (it != m_protocols.end()) {
         const KUrl url(*it + "://");
         if (!KProtocolManager::supportsListing(url)) {
-            QStringList::iterator tempIt = it;
-            ++tempIt;
-            m_protocols.erase(it);
-            it = tempIt;
+            it = m_protocols.erase(it);
         } else {
             ++it;
         }
[prev in list] [next in list] [prev in thread] [next in thread] 

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