Bug 130303 - kmail crash downloading pop3 msg without action of user
Summary: kmail crash downloading pop3 msg without action of user
Status: RESOLVED FIXED
Alias: None
Product: kmail
Classification: Applications
Component: general (show other bugs)
Version: unspecified
Platform: Mandriva RPMs Linux
: NOR crash (vote)
Target Milestone: ---
Assignee: kdepim bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-07-05 16:41 UTC by rapsys
Modified: 2007-09-14 12:17 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments
the kdbg output of crash_kmail_downloading_pop3_msg_without_action (3.25 KB, text/plain)
2006-07-05 16:42 UTC, rapsys
Details
the xsession-error output of crash_kmail_downloading_pop3_msg_without_action (2.84 KB, text/plain)
2006-07-05 16:43 UTC, rapsys
Details

Note You need to log in before you can comment on or make changes to this bug.
Description rapsys 2006-07-05 16:41:44 UTC
Version:           1.9.3 (using KDE KDE 3.5.3)
Installed from:    Mandriva RPMs
Compiler:          gcc-4.1.1 (GCC) 4.1.1 20060518 (prerelease) Target: i586-mandriva-linux-gnu; Configured with: ../configure --prefix=/usr --libexecdir=/usr/lib --with-slibdir=/lib --mandir=/usr/share/man --infodir=/usr/share/info --enable-shared --enable-threads=posix --enable-checking=release --enable-languages=c,c++,ada,fortran,objc,obj-c++,java --host=i586-mandriva-linux-gnu --with-system-zlib --enable-long-long --enable-__cxa_atexit --enable-clocale=gnu --disable-libunwind-exceptions --enable-java-awt=gtk --with-java-home=/usr/lib/jvm/java-1.4.2-gcj-1.4.2.0/jre --enable-gtk-cairo --enable-ssp --disable-libssp; Thread model: posix
OS:                Linux

I was doing something kmail minimized and it suddently crashed without reasons while downloading the mail automaticaly (every 10minutes)...

See attachement for kdbg output and xsession-error logs
Comment 1 rapsys 2006-07-05 16:42:16 UTC
Created attachment 16896 [details]
the kdbg output of crash_kmail_downloading_pop3_msg_without_action
Comment 2 rapsys 2006-07-05 16:43:00 UTC
Created attachment 16897 [details]
the xsession-error output of crash_kmail_downloading_pop3_msg_without_action
Comment 3 Philip Rodrigues 2006-07-05 21:06:39 UTC
Pasting the backtrace

#6  0xb715e3e9 in QMap<KPIM::ProgressItem*, bool>::isEmpty (this=0x892e6e8)
    at /usr/lib/qt3/include/qmap.h:722
#7  0xb7dbefce in KMail::PopAccount::slotJobFinished (this=0x884c9a0)
    at popaccount.cpp:785
#8  0xb7dc0e20 in KMail::PopAccount::slotCancel (this=0x884c9a0)
    at popaccount.cpp:300
#9  0xb7dc0ea3 in KMail::PopAccount::slotResult (this=0x884c9a0)
    at popaccount.cpp:981
#10 0xb7dc1141 in KMail::PopAccount::qt_invoke (this=0x884c9a0, _id=9, 
    _o=0xbfa872a4) at popaccount.moc:120
#11 0xb5bdbc84 in QObject::activate_signal ()
   from /usr/lib/qt3/lib/libqt-mt.so.3
#12 0xb684d277 in KIO::Job::result (this=0x8a1e5e8, t0=0x8a1e5e8)
    at jobclasses.moc:162
#13 0xb686da1c in KIO::Job::emitResult (this=0x8a1e5e8) at job.cpp:226
#14 0xb687db56 in KIO::SimpleJob::slotFinished (this=0x8a1e5e8) at job.cpp:574
#15 0xb688a8e9 in KIO::TransferJob::slotFinished (this=0x8a1e5e8)
    at job.cpp:944
#16 0xb68426e3 in KIO::SimpleJob::slotError (this=0x8a1e5e8, error=28, 
    errorText=@0x83f5ba0) at job.cpp:585
#17 0xb686c3ee in KIO::SimpleJob::qt_invoke (this=0x8a1e5e8, _id=14, 
    _o=0xbfa87640) at jobclasses.moc:424
#18 0xb686c574 in KIO::TransferJob::qt_invoke (this=0x8a1e5e8, _id=14, 
    _o=0xbfa87640) at jobclasses.moc:1082
#19 0xb5bdbbe1 in QObject::activate_signal ()
   from /usr/lib/qt3/lib/libqt-mt.so.3
#20 0xb685fc33 in KIO::SlaveInterface::error (this=0x89a7198, t0=28, 
    t1=@0xbfa87820) at slaveinterface.moc:214
Comment 4 Ingo Klöcker 2006-07-05 22:06:54 UTC
SVN commit 558673 by kloecker:

Fix progress item related crashes during POP3 fetches.

BUGS: 110487, 118112, 119112, 121384, 127210, 130303


 M  +4 -1      kmaccount.cpp  
 M  +30 -20    popaccount.cpp  


--- branches/KDE/3.5/kdepim/kmail/kmaccount.cpp #558672:558673
@@ -444,8 +444,11 @@
   if (mTimer)
     mTimer->start(mInterval*60000);
   if ( mMailCheckProgressItem ) {
-    mMailCheckProgressItem->setComplete(); // that will delete it
+    // set mMailCheckProgressItem = 0 before calling setComplete() to prevent
+    // a race condition
+    ProgressItem *savedMailCheckProgressItem = mMailCheckProgressItem;
     mMailCheckProgressItem = 0;
+    savedMailCheckProgressItem->setComplete(); // that will delete it
   }
 
   emit newMailsProcessed( mNewInFolder );
--- branches/KDE/3.5/kdepim/kmail/popaccount.cpp #558672:558673
@@ -348,8 +348,9 @@
 void PopAccount::slotAbortRequested()
 {
   if (stage == Idle) return;
-  disconnect( mMailCheckProgressItem, SIGNAL( progressItemCanceled( KPIM::ProgressItem* ) ),
-           this, SLOT( slotAbortRequested() ) );
+  if ( mMailCheckProgressItem )
+    disconnect( mMailCheckProgressItem, SIGNAL( progressItemCanceled( KPIM::ProgressItem* ) ),
+                this, SLOT( slotAbortRequested() ) );
   stage = Quit;
   if (job) job->kill();
   job = 0;
@@ -655,7 +656,8 @@
     processMsgsTimer.start(processingDelay);
   }
   else if (stage == Retr) {
-    mMailCheckProgressItem->setProgress( 100 );
+    if ( mMailCheckProgressItem )
+      mMailCheckProgressItem->setProgress( 100 );
     processRemainingQueuedMessages();
 
     mHeaderDeleteUids.clear();
@@ -732,20 +734,22 @@
     // If there are messages to delete then delete them
     if ( !idsOfMsgsToDelete.isEmpty() ) {
       stage = Dele;
-      mMailCheckProgressItem->setStatus(
-        i18n( "Fetched 1 message from %1. Deleting messages from server...",
-              "Fetched %n messages from %1. Deleting messages from server...",
-              numMsgs )
-        .arg( mHost ) );
+      if ( mMailCheckProgressItem )
+        mMailCheckProgressItem->setStatus(
+          i18n( "Fetched 1 message from %1. Deleting messages from server...",
+                "Fetched %n messages from %1. Deleting messages from server...",
+                numMsgs )
+          .arg( mHost ) );
       url.setPath("/remove/" + idsOfMsgsToDelete.join(","));
       kdDebug(5006) << "url: " << url.prettyURL() << endl;
     } else {
       stage = Quit;
-      mMailCheckProgressItem->setStatus(
-        i18n( "Fetched 1 message from %1. Terminating transmission...",
-              "Fetched %n messages from %1. Terminating transmission...",
-              numMsgs )
-        .arg( mHost ) );
+      if ( mMailCheckProgressItem )
+        mMailCheckProgressItem->setStatus(
+          i18n( "Fetched 1 message from %1. Terminating transmission...",
+                "Fetched %n messages from %1. Terminating transmission...",
+                numMsgs )
+          .arg( mHost ) );
       url.setPath(QString("/commit"));
       kdDebug(5006) << "url: " << url.prettyURL() << endl;
     }
@@ -760,11 +764,12 @@
       mUidsOfNextSeenMsgsDict.remove( mUidForIdMap[*it] );
     }
     idsOfMsgsToDelete.clear();
-    mMailCheckProgressItem->setStatus(
-      i18n( "Fetched 1 message from %1. Terminating transmission...",
-            "Fetched %n messages from %1. Terminating transmission...",
-            numMsgs )
-      .arg( mHost ) );
+    if ( mMailCheckProgressItem )
+      mMailCheckProgressItem->setStatus(
+        i18n( "Fetched 1 message from %1. Terminating transmission...",
+              "Fetched %n messages from %1. Terminating transmission...",
+              numMsgs )
+        .arg( mHost ) );
     KURL url = getUrl();
     url.setPath(QString("/commit"));
     job = KIO::get( url, false, false );
@@ -783,8 +788,11 @@
       int numMessages = canceled ? indexOfCurrentMsg : idsOfMsgs.count();
       BroadcastStatus::instance()->setStatusMsgTransmissionCompleted(
         this->name(), numMessages, numBytes, numBytesRead, numBytesToRead, mLeaveOnServer, mMailCheckProgressItem );
-      mMailCheckProgressItem->setComplete();
+      // set mMailCheckProgressItem = 0 before calling setComplete() to prevent
+      // a race condition
+      ProgressItem *savedMailCheckProgressItem = mMailCheckProgressItem;
       mMailCheckProgressItem = 0;
+      savedMailCheckProgressItem->setComplete(); // that will delete it
       checkDone( ( numMessages > 0 ), canceled ? CheckAborted : CheckOK );
     }
   }
@@ -873,7 +881,9 @@
       numMsgBytesRead = curMsgLen;
     numBytesRead += numMsgBytesRead - oldNumMsgBytesRead;
     dataCounter++;
-    if (dataCounter % 5 == 0)
+    if ( mMailCheckProgressItem &&
+         ( dataCounter % 5 == 0 ||
+           ( indexOfCurrentMsg + 1 == numMsgs && numMsgBytesRead == curMsgLen ) ) )
     {
       QString msg;
       if (numBytes != numBytesToRead && mLeaveOnServer)