From f739580db0f01e06275817c61d9041c599959730 Mon Sep 17 00:00:00 2001 From: hsoft Date: Wed, 30 Sep 2009 16:29:50 +0000 Subject: [PATCH] [#55 state:fixed] fixed a crash after makeReference when the action would make the dupe list smaller. --HG-- extra : convert_revision : svn%3Ac306627e-7827-47d3-bdf0-9a457c9553a1/trunk%40161 --- base/cocoa/ResultWindow.m | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/base/cocoa/ResultWindow.m b/base/cocoa/ResultWindow.m index 9ee36361..800daabc 100644 --- a/base/cocoa/ResultWindow.m +++ b/base/cocoa/ResultWindow.m @@ -244,9 +244,19 @@ http://www.hardcoded.net/licenses/hs_license - (IBAction)switchSelected:(id)sender { + // It might look like a complicated way to get the length of the current dupe list on the py side + // but after a lot of fussing around, believe it or not, it actually is. + int matchesTag = _powerMode ? 2 : 0; + int startLen = [[py getOutlineView:matchesTag childCountsForPath:[NSArray array]] count]; [self performPySelection:[self getSelectedPaths:YES]]; [py makeSelectedReference]; - [[NSNotificationCenter defaultCenter] postNotificationName:ResultsUpdatedNotification object:self]; + // In some cases (when in a filtered view in Power Marker mode, it's possible that the demoted + // ref is not a part of the filter, making the table smaller. In those cases, we want to do a + // complete reload of the table to avoid a crash. + if ([[py getOutlineView:matchesTag childCountsForPath:[NSArray array]] count] == startLen) + [[NSNotificationCenter defaultCenter] postNotificationName:ResultsUpdatedNotification object:self]; + else + [[NSNotificationCenter defaultCenter] postNotificationName:ResultsChangedNotification object:self]; } - (IBAction)togglePowerMarker:(id)sender