From f26e06f3891d0edf1464ccc348f124c7d4eaf904 Mon Sep 17 00:00:00 2001 From: rowanbeentje Date: Wed, 25 Mar 2009 00:26:02 +0000 Subject: Fix a reproducible sort-sort-refresh-sort crash bug by explicitly managing sortField and not referencing possibly deallocated column identifiers directly --- Source/TableContent.m | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'Source') 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]; -- cgit v1.2.3