FROM : Joan Lluch (casa)
DATE : Sun Jun 08 23:34:57 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.
Follow up:
Only by setting the highlight property of the outlineView to "Regular"
instead of "Source List" in IB all the problems were solved. Now
isGroupItem is only called a reasonable amount of times, and the app
no longer crashes. Of course, the visual aspect of the outlineView is
not the intended one though.
The problem can be partially reproduced in the DragNDropOutlineView
example project by setting "Source List" in IB for the outlineView
highlight property. You can also add an NSLog to the isGroupItem
method to clearly see how many times it is called. However, the app
does not crash when the items are trashed.
So, the crash apparently only happens in an app which uses Core Data
as the model source, and while undoing recently added items. Would
someone confirm this so I will issue a bug report to Apple?. In the
meantime, I will look whether I can easily reproduce it in any of the
examples provided by Apple.
Thanks.
DATE : Sun Jun 08 23:34:57 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.
Follow up:
Only by setting the highlight property of the outlineView to "Regular"
instead of "Source List" in IB all the problems were solved. Now
isGroupItem is only called a reasonable amount of times, and the app
no longer crashes. Of course, the visual aspect of the outlineView is
not the intended one though.
The problem can be partially reproduced in the DragNDropOutlineView
example project by setting "Source List" in IB for the outlineView
highlight property. You can also add an NSLog to the isGroupItem
method to clearly see how many times it is called. However, the app
does not crash when the items are trashed.
So, the crash apparently only happens in an app which uses Core Data
as the model source, and while undoing recently added items. Would
someone confirm this so I will issue a bug report to Apple?. In the
meantime, I will look whether I can easily reproduce it in any of the
examples provided by Apple.
Thanks.
| Related mails | Author | Date |
|---|---|---|
| Joan Lluch (casa) | Jun 8, 19:37 | |
| Kyle Sluder | Jun 8, 22:11 | |
| Joan Lluch (casa) | Jun 8, 23:04 | |
| Joan Lluch (casa) | Jun 8, 23:34 | |
| Joan Lluch (casa) | Jun 9, 00:02 | |
| Nathan Kinsinger | Jun 9, 03:06 | |
| carbonat | Jun 9, 11:09 | |
| Corbin Dunn | Jun 9, 18:00 | |
| carbonat | Jun 9, 18:21 | |
| Kyle Sluder | Jun 9, 18:45 |






Cocoa mail archive

