1
0
mirror of https://github.com/arsenetar/dupeguru.git synced 2025-03-10 05:34:36 +00:00

[#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
This commit is contained in:
hsoft 2009-09-30 16:29:50 +00:00
parent e7cdec93c0
commit f739580db0

View File

@ -244,9 +244,19 @@ http://www.hardcoded.net/licenses/hs_license
- (IBAction)switchSelected:(id)sender - (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]]; [self performPySelection:[self getSelectedPaths:YES]];
[py makeSelectedReference]; [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 - (IBAction)togglePowerMarker:(id)sender