aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrowanbeentje <rowan@beent.je>2009-11-01 16:22:00 +0000
committerrowanbeentje <rowan@beent.je>2009-11-01 16:22:00 +0000
commit6a9e12b0bc9600fa3a0b878b74854e5ef29964bb (patch)
tree58a7d1a43223b4bbb417750f4e8793af8992e5c3
parent99ddc3164f3e7da15bf65e663a939e9d7009fcd4 (diff)
downloadsequelpro-6a9e12b0bc9600fa3a0b878b74854e5ef29964bb.tar.gz
sequelpro-6a9e12b0bc9600fa3a0b878b74854e5ef29964bb.tar.bz2
sequelpro-6a9e12b0bc9600fa3a0b878b74854e5ef29964bb.zip
- 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
-rw-r--r--Source/SPQueryController.m1
-rw-r--r--Source/TableDocument.m10
2 files changed, 10 insertions, 1 deletions
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;
}