I am using outlineView:isGroupItem delegate method to create an NSOutlineView that mimics the look of Mail.app or iTunes

- (BOOL)outlineView:(NSOutlineView *)sender isGroupItem:(id)item
   {
return ( item && [[item representedObject] isKindOfClass: [GroupNode class]] ) ;
   }

My oulineView is binded to a treeController that in turn is binded to Core Data objects. The visual result is as expected and everything goes ok. When I add hierarchical objects to the managedObjectContext they correctly appear in the outlineView as expected. So far so good.

However, I observed that isGroupItem is called a lot more than apparently necessary, and I did not not observe any clear pattern for this. It is usually called as much as 20 or more times per item, in no particular order and also interlacing calls for different items. This should not be a big issue as far as the app remains responsible, although I find it hard to understand why isGroupItem does behave that way.

On the contrary, outlineView:willDisplayCell (below) behaves in a completely consistent way, as it is being called exactly column times for each row.

- (void)outlineView:(NSOutlineView *)sender willDisplayCell:(id)cell forTableColumn:(NSTableColumn *)tableColumn item:(id)item

The problem with isGroupItem is that it crashes the app (also not consistently) after several Undos performed on the managedObjectContext (to remove recently added objects) as it is eventually called with an already released "item". I do not understand it and I do not either know what to do or what to check in order to avoid this. Since my app relies on bindings and Core Data it has not a lot of code, and I am not able to find anything wrong in it.

Any help or hint to solve that issue will be appreciated.
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to