From 6a9e12b0bc9600fa3a0b878b74854e5ef29964bb Mon Sep 17 00:00:00 2001 From: rowanbeentje Date: Sun, 1 Nov 2009 16:22:00 +0000 Subject: - Fix a crash when opening .spfs caused by an autorelease - revert to manual memory management instead of r1455 approach, but fix leaks - Fix an exception caused by closing .spf windows while "Connecting..." windows were open --- Source/SPQueryController.m | 1 + Source/TableDocument.m | 10 +++++++++- 2 files changed, 10 insertions(+), 1 deletion(-) (limited to 'Source') diff --git a/Source/SPQueryController.m b/Source/SPQueryController.m index 422e1f59..8d38e72f 100644 --- a/Source/SPQueryController.m +++ b/Source/SPQueryController.m @@ -509,6 +509,7 @@ static SPQueryController *sharedQueryController = nil; NSArray *allDocs = [[NSDocumentController sharedDocumentController] documents]; NSMutableArray *allURLs = [NSMutableArray array]; for(id doc in allDocs) { + if (![doc fileURL]) continue; if([allURLs containsObject:[doc fileURL]]) return; else diff --git a/Source/TableDocument.m b/Source/TableDocument.m index 83b68bd4..c419bd1e 100644 --- a/Source/TableDocument.m +++ b/Source/TableDocument.m @@ -261,7 +261,7 @@ NSData *pData = [NSData dataWithContentsOfFile:path options:NSUncachedRead error:&readError]; spf = [[NSPropertyListSerialization propertyListFromData:pData - mutabilityOption:NSPropertyListImmutable format:&format errorDescription:&convError] autorelease]; + mutabilityOption:NSPropertyListImmutable format:&format errorDescription:&convError] retain]; if(!spf || readError != nil || [convError length] || !(format == NSPropertyListXMLFormat_v1_0 || format == NSPropertyListBinaryFormat_v1_0)) { NSAlert *alert = [NSAlert alertWithMessageText:[NSString stringWithFormat:NSLocalizedString(@"Error while reading connection data file", @"error while reading connection data file")] @@ -279,6 +279,7 @@ // For dispatching later if(![[spf objectForKey:@"format"] isEqualToString:@"connection"]) { NSLog(@"SPF file format is not 'connection'."); + [spf release]; [self close]; return; } @@ -292,6 +293,7 @@ [alert setAlertStyle:NSCriticalAlertStyle]; [alert runModal]; + [spf release]; [self close]; return; } @@ -332,6 +334,7 @@ encryptpw = [inputTextWindowSecureTextField stringValue]; else { [self close]; + [spf release]; return; } @@ -357,6 +360,7 @@ [alert setAlertStyle:NSCriticalAlertStyle]; [alert runModal]; [self close]; + [spf release]; return; } } @@ -371,6 +375,7 @@ [alert setAlertStyle:NSCriticalAlertStyle]; [alert runModal]; [self close]; + [spf release]; return; } @@ -385,6 +390,7 @@ [alert setAlertStyle:NSCriticalAlertStyle]; [alert runModal]; [self close]; + [spf release]; return; } @@ -485,6 +491,7 @@ [spfDocData setObject:[NSNumber numberWithBool:YES] forKey:@"auto_connect"]; [connectionController initiateConnection:self]; } + [spf release]; } /** @@ -2395,6 +2402,7 @@ // For dispatching later if(![[spf objectForKey:@"format"] isEqualToString:@"connection"]) { NSLog(@"SPF file format is not 'connection'."); + [spf release]; return NO; } -- cgit v1.2.3