Skip to content

Commit

Permalink
Fixed: the CPArrayController addObject: optimization for fast index u…
Browse files Browse the repository at this point in the history
…pdates would never fire with a nil _filterPredicate, causing rearrangeObjects to be called needlessly.
  • Loading branch information
aljungberg committed May 26, 2010
1 parent f7e2e9c commit 6ea2b4e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions AppKit/CPArrayController.j
Expand Up @@ -352,11 +352,11 @@
if (_clearsFilterPredicateOnInsertion)
[self setFilterPredicate:nil];

if ([_filterPredicate evaluateWithObject:object])
if (_filterPredicate === nil || [_filterPredicate evaluateWithObject:object])
{
[self willChangeValueForKey:@"selectionIndexes"];
var pos = [_arrangedObjects insertObject:object inArraySortedByDescriptors:_sortDescriptors];

[self willChangeValueForKey:@"selectionIndexes"];
[_selectionIndexes shiftIndexesStartingAtIndex:pos by:1];
[self didChangeValueForKey:@"selectionIndexes"];
}
Expand Down

0 comments on commit 6ea2b4e

Please sign in to comment.