Bug 65954 - crash: failed attempt to create imap folder on server creates orphan folder in folder treeview
Summary: crash: failed attempt to create imap folder on server creates orphan folder i...
Status: RESOLVED FIXED
Alias: None
Product: kmail
Classification: Applications
Component: IMAP (show other bugs)
Version: unspecified
Platform: Compiled Sources Linux
: NOR major
Target Milestone: ---
Assignee: kdepim bugs
URL:
Keywords:
: 66328 (view as bug list)
Depends on:
Blocks:
 
Reported: 2003-10-13 11:43 UTC by Will Stephenson
Modified: 2019-02-26 08:30 UTC (History)
2 users (show)

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 Will Stephenson 2003-10-13 11:43:44 UTC
Version:            (using KDE Devel)
Installed from:    Compiled sources
Compiler:          gcc (GCC) 3.3 20030226 (prerelease) (SuSE Linux) 
OS:          Linux

This is probably due to stupid-user-behaviour, but it crashes kmail.

Scenario: I'm setting up my first ever imap setup.  I've created a mailbox and I can view the contents and check for new mail using KMail.  I've created a few sub-folders to that mailbox, successfully, too.

Then I tried to create a new subfolder of the top level imap account folder.  I get a dialog back saying "Could not make directory imap://will@localhost:143/unnamed", but a subfolder appears there under KMail anyway.  Nothing is created on the imap server, of course.

If I try to delete the folder in KMail, it crashes KMail.  If I quit and restart KMail, this little orphan folder doesn't come back.

Backtrace: 
#3  <signal handler called>
#4  0x081c0aa9 in KMFolderImap::removeOnServer() (this=0x84647d8)
    at /home/will/projects/kde/src/kdepim/kmail/kmfolderimap.cpp:149
#5  0x08224821 in KMMainWidget::slotRemoveFolder() (this=0x84647d8)
    at /home/will/projects/kde/src/kdepim/kmail/kmmainwidget.cpp:946
#6  0x0821f4ad in KMMainWidget::qt_invoke(int, QUObject*) (this=0x84647d8, 
    _id=80, _o=0xbfffdd60) at kmail/kmmainwidget.moc:465

Let me know if you want any more of the bt, but AFAICS it's just the signal firing from me rightclicking in the listview and getting the context menu up.  I think the problem lies in the create subfolder code that creates an LVI even when the server operation failed.

Will
Comment 1 Till Adam 2003-10-23 11:34:58 UTC
It also crashes if you just leave it standing there on the next mailcheck. Seems imap specific.
Comment 2 Ingo Klöcker 2003-10-28 01:35:33 UTC
*** Bug 66328 has been marked as a duplicate of this bug. ***
Comment 3 Till Adam 2003-11-08 15:20:05 UTC
Subject: kdepim/kmail

CVS commit by tilladam: 

If creating a folder on an imap server fails make sure the already created
folder in the foldertree is removed and guard against crashing when the
non existing folder is mailchecked before it can be removed.

CCMAIL: 65954-done@bugs.kde.org


  M +7 -1      kmacctimap.cpp   1.144
  M +2 -0      kmfolderimap.cpp   1.143


--- kdepim/kmail/kmacctimap.cpp  #1.143:1.144
@@ -114,6 +114,12 @@ void KMAcctImap::slotSlaveError(KIO::Sla
           KIO::buildErrorString(errorCode, errorMsg));
     mErrorDialogIsActive = false;
-  } else
+  } else {
     kdDebug(5006) << "suppressing error:" << errorMsg << endl;
+  }
+  if ( errorCode == KIO::ERR_COULD_NOT_MKDIR ) {
+     // Creating a folder failed, remove it from the tree.
+     if ( mFolder )
+        mFolder->listDirectory( );
+  }
 }
 

--- kdepim/kmail/kmfolderimap.cpp  #1.142:1.143
@@ -1363,4 +1363,6 @@ void KMFolderImap::slotSetStatusResult(K
 void KMFolderImap::processNewMail(bool)
 {
+   // a little safety
+  if ( !mAccount ) return;
   KURL url = mAccount->getUrl();
   if (mReadOnly)