crash in outlineView:isGroupItem:
crash in outlineView:isGroupItem:
- Subject: crash in outlineView:isGroupItem:
- From: "Joan Lluch (casa)" <email@hidden>
- Date: Sun, 8 Jun 2008 19:37:12 +0200
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 (email@hidden)
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:
This email sent to email@hidden