Bug 56393

Summary: kmail crashes when I try change the name of an imap account
Product: [Applications] kmail Reporter: Torquil Macdonald Sørensen <torquil>
Component: generalAssignee: kdepim bugs <kdepim-bugs>
Severity: crash    
Priority: NOR    
Version: 1.5.1   
Target Milestone: ---   
Platform: unspecified   
OS: Linux   
Latest Commit: Version Fixed In:
Attachments: The KDE Crash Handler backtrace
Output from strace started just before clicking OK

Description Torquil Macdonald Sørensen 2003-03-25 18:02:18 UTC
Version:           1.5.1 (using KDE 3.1.1)
Installed from:     (testing/unstable)
Compiler:          gcc version 3.2.3 20030309 (Debian prerelease)
OS:          Linux (i686) release 2.4.21-pre5

How to reproduce:

1)	In the kmail configuration, the network section, click on the "Receiving" tab to get a list of incoming accounts.

2)	Choose an imap account, and click on modify

3)	Change the value in the "Name" field in the window that appears. Click OK.

4)	Click OK to exit the Configuration Window.

After step 4) kmail crashes immediately and disappears, and then the "KDE Crash Handler" appears.
Comment 1 Torquil Macdonald Sørensen 2003-03-25 18:03:41 UTC
Created attachment 1242 [details]
The KDE Crash Handler backtrace
Comment 2 Torquil Macdonald Sørensen 2003-03-25 18:05:18 UTC
Created attachment 1243 [details]
Output from strace started just before clicking OK

I started strace just before clicking OK for the last time, and stopped it when
the Crash Handler appeared
Comment 3 Carsten Burghardt 2003-03-25 21:57:36 UTC
Subject: KDE_3_1_BRANCH: kdenetwork/kmail

CVS commit by burghard: 

Fix bug #56393, we had a dangling pointer.
CCMAIL: 56393-done@bugs.kde.org

  M +7 -4      kmacctimap.cpp
  M +1 -1      kmacctimap.h

--- kdenetwork/kmail/kmacctimap.cpp  #
@@ -552,8 +552,11 @@ void KMAcctImap::slotSimpleResult(KIO::J
 void KMAcctImap::slotUpdateFolderList()
+  if (mFolder && mFolder->child())
+  {
   QStringList strList;
   kernel->imapFolderMgr()->createFolderList(&strList, &mMailCheckFolders,
     mFolder->child(), QString::null, false);
+  }

--- kdenetwork/kmail/kmacctimap.h  #
@@ -244,5 +244,5 @@ protected:
   KIO::MetaData mSlaveConfig;
   QPtrList<KMImapJob> mJobList;
-  KMFolderImap *mFolder;
+  QGuardedPtr<KMFolderImap> mFolder;
   int mCountUnread, mCountLastUnread;
   int mCountRemainChecks;