Bug 127210 - kmail crash on selecting threading
Summary: kmail crash on selecting threading
Status: RESOLVED FIXED
Alias: None
Product: kmail
Classification: Applications
Component: general (show other bugs)
Version: 1.9.1
Platform: unspecified Linux
: NOR crash (vote)
Target Milestone: ---
Assignee: kdepim bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-05-12 17:48 UTC by Martin
Modified: 2007-09-14 12:17 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Martin 2006-05-12 17:48:29 UTC
Version:           1.9.1 (using KDE 3.5.2, Mandrake Linux Cooker i586 - Cooker)
Compiler:          gcc version 3.3.1 (Mandrake Linux 9.2 3.3.1-2mdk)
OS:                Linux (i686) release 2.6.13-oci2.mdk-i686-up-4GB

when I selected folder|thread 'messages from'  after a period of time, kmail crashed

(no debugging symbols found)
Using host libthread_db library "/lib/i686/libthread_db.so.1".
(no debugging symbols found)
`shared object read from target memory' has disappeared; keeping its symbols.
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
[KCrash handler]
#7  0x41a29e3e in QString::deref () from /usr/lib/qt3/lib/libqt-mt.so.3
#8  0x41a29f28 in QString::operator= () from /usr/lib/qt3/lib/libqt-mt.so.3
#9  0x430ea7e5 in KPIM::ProgressItem::setStatus ()
   from /usr/lib/libkdepim.so.1
#10 0x430fca30 in KPIM::BroadcastStatus::setStatusMsgTransmissionCompleted ()
   from /usr/lib/libkdepim.so.1
#11 0x4363599f in KMail::PopAccount::slotJobFinished ()
   from /usr/lib/libkmailprivate.so
#12 0x43637c1a in KMail::PopAccount::slotResult ()
   from /usr/lib/libkmailprivate.so
#13 0x43638073 in KMail::PopAccount::qt_invoke ()
   from /usr/lib/libkmailprivate.so
#14 0x417797f7 in QObject::activate_signal ()
   from /usr/lib/qt3/lib/libqt-mt.so.3
#15 0x42612176 in KIO::Job::result () from /usr/lib/libkio.so.4
#16 0x425fb4e0 in KIO::Job::emitResult () from /usr/lib/libkio.so.4
#17 0x425fc9e9 in KIO::SimpleJob::slotFinished () from /usr/lib/libkio.so.4
#18 0x425ff961 in KIO::TransferJob::slotFinished () from /usr/lib/libkio.so.4
#19 0x42613e2d in KIO::TransferJob::qt_invoke () from /usr/lib/libkio.so.4
#20 0x417797f7 in QObject::activate_signal ()
   from /usr/lib/qt3/lib/libqt-mt.so.3
#21 0x417795f3 in QObject::activate_signal ()
   from /usr/lib/qt3/lib/libqt-mt.so.3
#22 0x425efa98 in KIO::SlaveInterface::finished () from /usr/lib/libkio.so.4
#23 0x425ee6ab in KIO::SlaveInterface::dispatch () from /usr/lib/libkio.so.4
#24 0x425edc79 in KIO::SlaveInterface::dispatch () from /usr/lib/libkio.so.4
#25 0x425eb7eb in KIO::Slave::gotInput () from /usr/lib/libkio.so.4
#26 0x425ed1cc in KIO::Slave::qt_invoke () from /usr/lib/libkio.so.4
#27 0x417797f7 in QObject::activate_signal ()
   from /usr/lib/qt3/lib/libqt-mt.so.3
#28 0x417798ee in QObject::activate_signal ()
   from /usr/lib/qt3/lib/libqt-mt.so.3
#29 0x41a6b498 in QSocketNotifier::activated ()
   from /usr/lib/qt3/lib/libqt-mt.so.3
#30 0x41793d61 in QSocketNotifier::event ()
   from /usr/lib/qt3/lib/libqt-mt.so.3
#31 0x4172007f in QApplication::internalNotify ()
   from /usr/lib/qt3/lib/libqt-mt.so.3
#32 0x4171f617 in QApplication::notify () from /usr/lib/qt3/lib/libqt-mt.so.3
#33 0x4205125b in KApplication::notify () from /usr/lib/libkdecore.so.4
#34 0x4170fe2e in QEventLoop::activateSocketNotifiers ()
   from /usr/lib/qt3/lib/libqt-mt.so.3
#35 0x416cad57 in QEventLoop::processEvents ()
   from /usr/lib/qt3/lib/libqt-mt.so.3
#36 0x417307ca in QEventLoop::enterLoop () from /usr/lib/qt3/lib/libqt-mt.so.3
#37 0x417306b4 in QEventLoop::exec () from /usr/lib/qt3/lib/libqt-mt.so.3
#38 0x41720290 in QApplication::exec () from /usr/lib/qt3/lib/libqt-mt.so.3
#39 0x0804a3c1 in ?? ()
#40 0xbf9bad80 in ?? ()
#41 0x08079488 in ?? ()
#42 0xbf9baeb8 in ?? ()
#43 0x0804a3a2 in ?? ()
#44 0x41b686c0 in vtable for QGArray () from /usr/lib/qt3/lib/libqt-mt.so.3
#45 0x08165c10 in ?? ()
#46 0x4217ff5e in posix_memalign () from /usr/lib/libkdecore.so.4
#47 0x45d42c57 in __libc_start_main () from /lib/i686/libc.so.6
#48 0x0804a161 in ?? ()
Comment 1 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)