Skip navigation.
 
mlcrash in outlineView:isGroupItem:
FROM : Joan Lluch (casa)
DATE : Sun Jun 08 19:37:12 2008

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.

Related mailsAuthorDate
mlcrash in outlineView:isGroupItem: Joan Lluch (casa) Jun 8, 19:37
mlRe: crash in outlineView:isGroupItem: Kyle Sluder Jun 8, 22:11
mlRe: crash in outlineView:isGroupItem: Joan Lluch (casa) Jun 8, 23:04
mlcrash in outlineView:isGroupItem: Joan Lluch (casa) Jun 8, 23:34
mlcrash in outlineView:isGroupItem: Joan Lluch (casa) Jun 9, 00:02
mlRe: crash in outlineView:isGroupItem: Nathan Kinsinger Jun 9, 03:06
mlRe: crash in outlineView:isGroupItem: carbonat Jun 9, 11:09
mlRe: crash in outlineView:isGroupItem: Corbin Dunn Jun 9, 18:00
mlRe: crash in outlineView:isGroupItem: carbonat Jun 9, 18:21
mlRe: crash in outlineView:isGroupItem: Kyle Sluder Jun 9, 18:45