[Bug 140660] kmail crash when I make a CTRL + J in inbox

Allen Winter winter at kde.org
Wed Feb 7 18:22:21 GMT 2007


------- 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=140660         




------- Additional Comments From winter kde org  2007-02-07 19:22 -------
SVN commit 631330 by winterz:

possible fix to " kmail crash when I make a CTRL + J in inbox "
CCBUG: 140660

would appreciate people testing this.
find a folder with about 500 or messages.
select all messages
apply all filters (ctrl+j)


 M  +2 -1      branches/work/kdepim-3.5.5+/kmail/folderstorage.cpp  
 M  +2 -2      branches/work/kdepim-3.5.5+/kmail/kmfolder.cpp  
 M  +15 -14    branches/work/kdepim-3.5.5+/kmail/kmheaders.cpp  


--- branches/work/kdepim-3.5.5+/kmail/folderstorage.cpp #631329:631330
 @ -451,7 +451,8  @
     if (msg->parent())
     {
       int idx = msg->parent()->find(msg);
-      take(idx);
+      if ( idx >= 0 )
+        take(idx);
     }
   }
 }
--- branches/work/kdepim-3.5.5+/kmail/kmfolder.cpp #631329:631330
 @ -426,12 +426,12  @
 
 int KMFolder::find( const KMMsgBase* msg ) const
 {
-  return mStorage ? mStorage->find( msg ) : 0;
+  return mStorage ? mStorage->find( msg ) : -1;
 }
 
 int KMFolder::find( const KMMessage* msg ) const
 {
-  return mStorage ? mStorage->find( msg ) : 0;
+  return mStorage ? mStorage->find( msg ) : -1;
 }
 
 int KMFolder::count( bool cache ) const
--- branches/work/kdepim-3.5.5+/kmail/kmheaders.cpp #631329:631330
 @ -1380,8 +1380,9  @
     HeaderItem *nextItem = prepareMove( &contentX, &contentY );
 
     KMMessageList* msgList = selectedMsgs();
-    if (msgList->isEmpty())
+    if (msgList->count() < 1)
       return;
+
     finalizeMove( nextItem, contentX, contentY );
 
     CREATE_TIMER(filter);
 @ -1404,20 +1405,20  @
         KApplication::kApplication()->eventLoop()->processEvents( QEventLoop::ExcludeUserInput, 50 );
       }
       int idx = msgBase->parent()->find(msgBase);
-      assert(idx != -1);
-      KMMessage * msg = msgBase->parent()->getMsg(idx);
-      if (msg->transferInProgress()) continue;
-      msg->setTransferInProgress(true);
-      if ( !msg->isComplete() )
-      {
-        FolderJob *job = mFolder->createJob(msg);
-        connect(job, SIGNAL(messageRetrieved(KMMessage*)),
-                     SLOT(slotFilterMsg(KMMessage*)));
-        job->start();
-      } else {
-        if (slotFilterMsg(msg) == 2) break;
+      if ( idx >= 0 ) {
+        KMMessage * msg = msgBase->parent()->getMsg(idx);
+        if (msg->transferInProgress()) continue;
+        msg->setTransferInProgress(true);
+        if ( !msg->isComplete() ) {
+          FolderJob *job = mFolder->createJob(msg);
+          connect(job, SIGNAL(messageRetrieved(KMMessage*)),
+                  SLOT(slotFilterMsg(KMMessage*)));
+          job->start();
+        } else {
+          if (slotFilterMsg(msg) == 2) break;
+        }
+        progressItem->incCompletedItems();
       }
-      progressItem->incCompletedItems();
     }
     progressItem->setComplete();
     progressItem = 0;



More information about the Kdepim-bugs mailing list