[Bug 113885] Crash while imap search (with BT)

Will Stephenson <[email protected]>
Newsgroups gmane.comp.kde.devel.kmail
Message-ID <[email protected]>
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
         
http://bugs.kde.org/show_bug.cgi?id=113885         
wstephenson kde org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED



------- Additional Comments From wstephenson kde org  2007-03-22 13:54 -------
SVN commit 645363 by wstephens:

The check for unmatched UIDs also needs to be carried out after all the folders have been fetched, to exclude the possiblity that the local folder contents changed while the imap search was working.  This weeds out unmatched UIDs before passing the search results upwards.
BUG: 113885


 M  +6 -1      searchjob.cpp  


--- branches/KDE/3.5/kdepim/kmail/searchjob.cpp #645362:645363
 @ -222,7 +222,12  @
     for ( QStringList::Iterator it = mImapSearchHits.begin(); 
         it != mImapSearchHits.end(); ++it ) 
     {
-      serNums.append( mFolder->serNumForUID( (*it).toULong() ) );
+      ulong serNum = mFolder->serNumForUID( (*it).toULong() );
+      // we need to check that the local folder does contain a message for this UID. 
+      // scenario: server responds with a list of UIDs.  While the search was running, filtering or bad juju moved a message locally
+      // serNumForUID will happily return 0 for the missing message, and KMFolderSearch::addSerNum() will fail its assertion.
+      if ( serNum != 0 ) 
+        serNums.append( serNum );
     }
     emit searchDone( serNums, mSearchPattern, true );
   } else {
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.