tags 659489 + patch clone 659489 -1 reassign -1 libpantomime1.2 retitle -1 CWConnection instance may get deallocated while CWService handles the runloop event severity -1 serious affects -1 gnumail.app tags -1 + patch block 659489 with -1 thanks
Sorry for not being able to reply earlier. On Sat, Feb 11, 2012 at 03:29:43PM +0100, Csányi Pál wrote: > when I edit my account and want to setup smtp server on the Send tab I > have the followings settings: > Transport: SMTP > Server name: smtp.gmail.com > Server port: 587 > Use secure: TLS > yes, Use SMTP authentication > Mechanism: None Check supported > > Note 1: when I clicked on this button to check supported mechanism, > nothing happen. That's because TLS is not implemented. In the attached patch I disabled it in the UI to avoid confusion. Only SSL is available. > Now when I hit on the OK button, GNUMail crashes. Yes, that's fairly easy to reproduce. It looks like a CWSMTP object gets allocated, but it's never released. Worse, GNUMail doesn't keep track of the SMTP connection and doesn't close it properly so when the account window is closed (no matter how), you get a crash. Fixing this exposes another bug in the Pantomime library -- the object may get deallocated during -updateRead/-updateWrite in which case _delegate is invalid and you get a crash as well. Could you (or someone else) please try the attached patches? I am able to add/delete/edit accounts, check supported authentication mechanisms and actually send mail. Reading messages with IMAP and replying also works for me.
--- gnumail-1.2.0~pre3+snap20071004.orig/Bundles/Account/AccountEditorWindowController.h +++ gnumail-1.2.0~pre3+snap20071004/Bundles/Account/AccountEditorWindowController.h @@ -30,6 +30,7 @@ @class FolderNode; @class CWIMAPStore; +@class CWSMTP; @interface AccountEditorWindowController: NSWindowController { @@ -101,6 +102,7 @@ NSMutableArray *allVisibleFolders; FolderNode *allFolders, *allNodes; CWIMAPStore *store; + CWSMTP *aSMTP; NSString *key; int operation; BOOL _ready; --- gnumail-1.2.0~pre3+snap20071004.orig/Bundles/Account/AccountEditorWindowController.m +++ gnumail-1.2.0~pre3+snap20071004/Bundles/Account/AccountEditorWindowController.m @@ -93,6 +93,7 @@ allFolders = [[FolderNode alloc] init]; [allFolders setName: _(@"All Mailboxes")]; store = nil; + aSMTP = nil; #ifdef MACOSX @@ -211,13 +212,9 @@ [receiveUseSecureConnection removeAllItems]; [receiveUseSecureConnection addItemWithTitle: _(@"No")]; [receiveUseSecureConnection addItemWithTitle: _(@"SSL")]; - [receiveUseSecureConnection addItemWithTitle: _(@"TLS, if available")]; - [receiveUseSecureConnection addItemWithTitle: _(@"TLS")]; [sendUseSecureConnection removeAllItems]; [sendUseSecureConnection addItemWithTitle: _(@"No")]; [sendUseSecureConnection addItemWithTitle: _(@"SSL")]; - [sendUseSecureConnection addItemWithTitle: _(@"TLS, if available")]; - [sendUseSecureConnection addItemWithTitle: _(@"TLS")]; // We select default items in various popups and we refresh the view [personalSignaturePopUp selectItemAtIndex: 0]; @@ -293,6 +290,13 @@ } } + if (aSMTP) + { + [aSMTP setDelegate: nil]; + [aSMTP close]; + DESTROY(aSMTP); + } + [super dealloc]; } @@ -906,11 +910,9 @@ // - (IBAction) sendSupportedMechanismsButtonClicked: (id) sender { - CWSMTP *aSMTP; int value; [sendSupportedMechanismsPopUp removeAllItems]; - [sendSupportedMechanismsPopUp addItemWithTitle: _(@"None")]; // We get our SMTP port value (can be other than 25!) value = [sendSMTPPortField intValue]; @@ -942,7 +944,8 @@ NULL, NULL, [sendSMTPHostField stringValue]); - AUTORELEASE(aSMTP); + [aSMTP setDelegate: nil]; + DESTROY(aSMTP); return; } @@ -1782,10 +1785,10 @@ NSLog(@"Closing..."); - if ([o isKindOfClass: [CWSMTP class]]) + if ([o isEqual: aSMTP]) { - [o setDelegate: nil]; - AUTORELEASE(o); + [aSMTP setDelegate: nil]; + DESTROY(aSMTP); } else {
--- pantomime1.2-1.2.0~pre3+snap20071004+dfsg.orig/Framework/Pantomime/CWService.m +++ pantomime1.2-1.2.0~pre3+snap20071004+dfsg/Framework/Pantomime/CWService.m @@ -639,6 +639,8 @@ extra: (void *) theExtra forMode: (NSString *) theMode { + [[self retain] autorelease]; + switch (theType) { #ifdef __MINGW32__