Bug 137302

Summary: crash when deleting imap and creating pop account in one step
Product: [Applications] kmail Reporter: Willi Richert <w.richert>
Component: IMAPAssignee: kdepim bugs <kdepim-bugs>
Status: RESOLVED FIXED    
Severity: crash    
Priority: NOR    
Version: 1.9.1   
Target Milestone: ---   
Platform: unspecified   
OS: Linux   
Latest Commit: Version Fixed In:

Description Willi Richert 2006-11-13 21:25:43 UTC
Version:           1.9.1 (using KDE 3.5.2, Kubuntu Package 4:3.5.2-0ubuntu18.1 dapper)
Compiler:          Target: i486-linux-gnu
OS:                Linux (i686) release 2.6.15-26-386

Maybe this is related to the Spam Wizard bug: When enabled it keeps on downloading and uploading mails forever, with the inbox growing continuously

[KCrash handler]
#6  0xb563a953 in KMail::ImapJob::slotPutMessageDataReq ()
   from /usr/lib/libkmailprivate.so
#7  0xb563d374 in KMail::ImapJob::qt_invoke ()
   from /usr/lib/libkmailprivate.so
#8  0xb706a051 in QObject::activate_signal () from /usr/lib/libqt-mt.so.3
#9  0xb6b58fd1 in KIO::TransferJob::dataReq () from /usr/lib/libkio.so.4
#10 0xb6b66f5d in KIO::TransferJob::slotDataReq () from /usr/lib/libkio.so.4
#11 0xb6baab23 in KIO::TransferJob::qt_invoke () from /usr/lib/libkio.so.4
#12 0xb706a051 in QObject::activate_signal () from /usr/lib/libqt-mt.so.3
#13 0xb706aaec in QObject::activate_signal () from /usr/lib/libqt-mt.so.3
#14 0xb6b52970 in KIO::SlaveInterface::dataReq () from /usr/lib/libkio.so.4
#15 0xb6bc2d6f in KIO::SlaveInterface::dispatch () from /usr/lib/libkio.so.4
#16 0xb6b69739 in KIO::SlaveInterface::dispatch () from /usr/lib/libkio.so.4
#17 0xb6b6e230 in KIO::Slave::gotInput () from /usr/lib/libkio.so.4
#18 0xb6b6e3c5 in KIO::Slave::qt_invoke () from /usr/lib/libkio.so.4
#19 0xb706a051 in QObject::activate_signal () from /usr/lib/libqt-mt.so.3
#20 0xb706a960 in QObject::activate_signal () from /usr/lib/libqt-mt.so.3
#21 0xb73fe207 in QSocketNotifier::activated () from /usr/lib/libqt-mt.so.3
#22 0xb708a396 in QSocketNotifier::event () from /usr/lib/libqt-mt.so.3
#23 0xb6ffff3e in QApplication::internalNotify () from /usr/lib/libqt-mt.so.3
#24 0xb700013a in QApplication::notify () from /usr/lib/libqt-mt.so.3
#25 0xb76fdd7d in KApplication::notify () from /usr/lib/libkdecore.so.4
#26 0xb6f91157 in QApplication::sendEvent () from /usr/lib/libqt-mt.so.3
#27 0xb6ff1a5b in QEventLoop::activateSocketNotifiers ()
   from /usr/lib/libqt-mt.so.3
#28 0xb6fa4f43 in QEventLoop::processEvents () from /usr/lib/libqt-mt.so.3
#29 0xb7018a2f in QEventLoop::enterLoop () from /usr/lib/libqt-mt.so.3
#30 0xb7018952 in QEventLoop::exec () from /usr/lib/libqt-mt.so.3
#31 0xb6ffea4d in QApplication::exec () from /usr/lib/libqt-mt.so.3
Comment 1 Will Stephenson 2007-03-22 15:10:09 UTC
SVN commit 645389 by wstephens:

When deleting an account, there may be jobs live on that account that aren't automatically cleaned up.  Make them safe in places where they lookup the account.
BUG: 137302


 M  +30 -0     imapjob.cpp  


--- branches/KDE/3.5/kdepim/kmail/imapjob.cpp #645388:645389
@@ -502,6 +502,12 @@
 void ImapJob::slotPutMessageDataReq( KIO::Job *job, QByteArray &data )
 {
   KMAcctImap *account = static_cast<KMFolderImap*>(mDestFolder->storage())->account();
+  if ( !account )
+  {
+    emit finished();
+    deleteLater();
+    return;
+  }
   ImapAccountBase::JobIterator it = account->findJob( job );
   if ( it == account->jobsEnd() ) return;
 
@@ -522,6 +528,12 @@
 void ImapJob::slotPutMessageResult( KIO::Job *job )
 {
   KMAcctImap *account = static_cast<KMFolderImap*>(mDestFolder->storage())->account();
+  if ( !account )
+  {
+    emit finished();
+    deleteLater();
+    return;
+  }
   ImapAccountBase::JobIterator it = account->findJob( job );
   if ( it == account->jobsEnd() ) return;
   bool deleteMe = false;
@@ -562,6 +574,12 @@
 {
   KMFolderImap * imapFolder = static_cast<KMFolderImap*>(mDestFolder->storage());
   KMAcctImap *account = imapFolder->account();
+  if ( !account )
+  {
+    emit finished();
+    deleteLater();
+    return;
+  }
   ImapAccountBase::JobIterator it = account->findJob( job );
   if ( it == account->jobsEnd() ) return;
 
@@ -595,6 +613,12 @@
 {
   KMFolderImap * imapFolder = static_cast<KMFolderImap*>(mDestFolder->storage());
   KMAcctImap *account = imapFolder->account();
+  if ( !account )
+  {
+    emit finished();
+    deleteLater();
+    return;
+  }
   ImapAccountBase::JobIterator it = account->findJob( job );
   if ( it == account->jobsEnd() ) return;
 
@@ -613,6 +637,12 @@
 void ImapJob::slotCopyMessageResult( KIO::Job *job )
 {
   KMAcctImap *account = static_cast<KMFolderImap*>(mDestFolder->storage())->account();
+  if ( !account )
+  {
+    emit finished();
+    deleteLater();
+    return;
+  }
   ImapAccountBase::JobIterator it = account->findJob( job );
   if ( it == account->jobsEnd() ) return;