Permalink
Browse files

Misc fixes

  • Loading branch information...
1 parent e0396cb commit 9aec18fe31a7b907244e8c96d99a86278f4a71e2 @mronge mronge committed Nov 6, 2012
Showing with 10 additions and 6 deletions.
  1. +8 −4 Source/CTCoreFolder.m
  2. +1 −1 Source/CTCoreMessage.m
  3. +1 −1 Source/MailCoreUtilities.m
View
@@ -135,6 +135,7 @@ - (BOOL)setPath:(NSString *)path; {
- (CTIdleResult)idleWithTimeout:(NSUInteger)timeout {
NSAssert(!self.idling, @"Can't call idle when we are already idling!");
+ self.lastError = nil;
BOOL success = [self connect];
if (!success) {
@@ -145,7 +146,10 @@ - (CTIdleResult)idleWithTimeout:(NSUInteger)timeout {
int r = 0;
self.idling = YES;
- pipe(idlePipe);
+ r = pipe(idlePipe);
+ if (r == -1) {
+ return CTIdleError;
+ }
self.imapSession->imap_selection_info->sel_exists = 0;
r = mailimap_idle(self.imapSession);
@@ -197,13 +201,13 @@ - (CTIdleResult)idleWithTimeout:(NSUInteger)timeout {
self.lastError = MailCoreCreateErrorFromIMAPCode(r);
result = CTIdleError;
}
-
+
+ self.idling = NO;
close(idlePipe[1]);
close(idlePipe[0]);
idlePipe[1] = -1;
idlePipe[0] = -1;
- self.idling = NO;
-
+
return result;
}
View
@@ -47,7 +47,7 @@ @implementation CTCoreMessage
@synthesize mime=myParsedMIME, lastError, parentFolder;
- (id)init {
- [super init];
+ self = [super init];
if (self) {
struct mailimf_fields *fields = mailimf_fields_new_empty();
myFields = mailimf_single_fields_new(fields);
@@ -77,7 +77,7 @@ void MailCoreDisableLogging() {
default: {
const char *errStr = mailsmtp_strerror(errcode);
if (errStr) {
- description = [[NSString alloc] initWithCString:errStr encoding:NSUTF8StringEncoding];
+ description = [[[NSString alloc] initWithCString:errStr encoding:NSUTF8StringEncoding] autorelease];
}
break;
}

0 comments on commit 9aec18f

Please sign in to comment.