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

List:       kde-commits
Subject:    KDE/kdepim/kmail
From:       Thomas McGuire <Thomas.McGuire () gmx ! net>
Date:       2008-07-31 21:58:58
Message-ID: 1217541538.584265.14276.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 840343 by tmcguire:

Don't crash when running the anti-spam wizard and spam filter rules exist already.

I've simply replaced an iterator-loop with a for-loop, can anybody who understands iterators
point me to the reason why the iterator-based version crashed? Because I have no idea.
(I also tried removing the const from the iterator, but that didn't help)

BUG: 166477


 M  +5 -5      kmfiltermgr.cpp  


--- trunk/KDE/kdepim/kmail/kmfiltermgr.cpp #840342:840343
@@ -451,11 +451,11 @@
   if ( replaceIfNameExists ) {
     QList<KMFilter*>::const_iterator it1 = filters.begin();
     for ( ; it1 != filters.end() ; ++it1 ) {
-      QList<KMFilter*>::const_iterator it2 = mFilters.begin();
-      for ( ; it2 != mFilters.end() ; ++it2 ) {
-        if ( (*it1)->name() == (*it2)->name() ) {
-          mFilters.removeAll( (*it2) );
-          it2 = mFilters.constBegin();
+      for ( int i = 0; i < mFilters.count(); i++ ) {
+        KMFilter *filter = mFilters[i];
+        if ( (*it1)->name() == filter->name() ) {
+          mFilters.removeAll( filter );
+          i = 0;
         }
       }
     }
[prev in list] [next in list] [prev in thread] [next in thread] 

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