aboutsummaryrefslogtreecommitdiffstats
path: root/Source/TableContent.m
diff options
context:
space:
mode:
authorrowanbeentje <rowan@beent.je>2009-03-25 00:26:02 +0000
committerrowanbeentje <rowan@beent.je>2009-03-25 00:26:02 +0000
commitf26e06f3891d0edf1464ccc348f124c7d4eaf904 (patch)
tree52ea9682d7097002e1bba46d6f406d010fb72136 /Source/TableContent.m
parent554bd36e530cf2d9869466a4b31bc2219bd3aed5 (diff)
downloadsequelpro-f26e06f3891d0edf1464ccc348f124c7d4eaf904.tar.gz
sequelpro-f26e06f3891d0edf1464ccc348f124c7d4eaf904.tar.bz2
sequelpro-f26e06f3891d0edf1464ccc348f124c7d4eaf904.zip
Fix a reproducible sort-sort-refresh-sort crash bug by explicitly managing sortField and not referencing possibly deallocated column identifiers directly
Diffstat (limited to 'Source/TableContent.m')
-rw-r--r--Source/TableContent.m10
1 files changed, 7 insertions, 3 deletions
diff --git a/Source/TableContent.m b/Source/TableContent.m
index 67bb68b9..a7dfef7d 100644
--- a/Source/TableContent.m
+++ b/Source/TableContent.m
@@ -205,7 +205,10 @@
// Otherwise, clear sorting
} else {
- sortField = nil;
+ if (sortField) {
+ [sortField release];
+ sortField = nil;
+ }
isDesc = NO;
}
@@ -1739,7 +1742,8 @@ objectValueForTableColumn:(NSTableColumn *)aTableColumn
isDesc = NO;
[tableContentView setIndicatorImage:nil inTableColumn:[tableContentView tableColumnWithIdentifier:sortField]];
}
- sortField = [tableColumn identifier];
+ if (sortField) [sortField release];
+ sortField = [[NSString alloc] initWithString:[tableColumn identifier]];
//make queryString and perform query
queryString = [NSString stringWithFormat:@"SELECT %@ FROM %@ ORDER BY %@", [self fieldListForQuery],
@@ -2094,7 +2098,7 @@ objectValueForTableColumn:(NSTableColumn *)aTableColumn
[keys release];
[oldRow release];
[compareType release];
- [sortField release];
+ if (sortField) [sortField release];
[prefs release];
[super dealloc];