diff options
author | stuconnolly <stuart02@gmail.com> | 2009-08-03 15:25:15 +0000 |
---|---|---|
committer | stuconnolly <stuart02@gmail.com> | 2009-08-03 15:25:15 +0000 |
commit | fa8bc031af44a2ae8e9d71bddaa2fb7770774b42 (patch) | |
tree | d9069891dcfec2f53b4e26bbf54052b0bbe58fca /Source | |
parent | 4771125522466da812207d1214d44d0ef8f3a012 (diff) | |
download | sequelpro-fa8bc031af44a2ae8e9d71bddaa2fb7770774b42.tar.gz sequelpro-fa8bc031af44a2ae8e9d71bddaa2fb7770774b42.tar.bz2 sequelpro-fa8bc031af44a2ae8e9d71bddaa2fb7770774b42.zip |
Don't release the server variables array as it's simply a weak reference when filtering is not taking place, fixes a crash. Also, if the panel is opened and the search field contains a value that was previously filter using, perform the filtering using this value before the sheet is displayed.
Diffstat (limited to 'Source')
-rw-r--r-- | Source/TableDocument.m | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/Source/TableDocument.m b/Source/TableDocument.m index 07a8538f..77bc78d7 100644 --- a/Source/TableDocument.m +++ b/Source/TableDocument.m @@ -1311,11 +1311,6 @@ int i; NSMutableArray *tempResult = [NSMutableArray array]; - if (variables) { - [variables release]; - variables = nil; - } - if (variablesFiltered) { [variablesFiltered release]; variablesFiltered = nil; @@ -1332,11 +1327,16 @@ variablesFiltered = [[NSArray arrayWithArray:tempResult] retain]; - // Weak pointer + // Weak reference variables = variablesFiltered; [variablesTableView reloadData]; + // If the search field already has value from when the panel was previously open, apply the filter. + if ([[variablesSearchField stringValue] length] > 0) { + [self _updateServerVariablesFilterForFilterString:[variablesSearchField stringValue]]; + } + // Show variables sheet [NSApp beginSheet:variablesSheet modalForWindow:tableWindow modalDelegate:self @@ -2155,7 +2155,7 @@ } if (object == variablesSearchField) { - [self _updateServerVariablesFilterForFilterString:[[object stringValue] lowercaseString]]; + [self _updateServerVariablesFilterForFilterString:[object stringValue]]; } } @@ -2257,6 +2257,8 @@ { [saveVariablesButton setEnabled:NO]; + filterString = [filterString lowercaseString]; + filterString = [filterString stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]]; variables = [[NSMutableArray alloc] init]; |