Re: NSOutlineView blowing stack
Re: NSOutlineView blowing stack
- Subject: Re: NSOutlineView blowing stack
- From: Tom Harrington <email@hidden>
- Date: Thu, 19 Feb 2004 17:11:10 -0700
On Thursday, February 19, 2004, at 04:48 PM, Allan Odgaard wrote:
On 19. Feb 2004, at 23:53, Tom Harrington wrote:
I'm using an NSOutlineView that, when I call -reloadData, will
sometimes get into a recursive loop of function calls until it runs
out of stack space. [...]
Does the data contain cycles? i.e. a dictionary having a key for a
child array, where each child has a parent key pointing back to the
original dictionary?
Yes-- I'm tagging each child with a pointer to its parent. The outline
column has a checkbox in it, and clicking the checkbox in one item may
affect the parent item's checkbox state.
At least this will do it -- I am not entirely sure what goes wrong:
comparing dictionaries and arrays (with isEqual:) should be safe, even
when cyclic data appear (because it doesn't do a deep compare unless
the pointers differ), but the NSOutlineView will often do infinite
recursions when handed such data.
That would seem to be the case, and I suppose collapsing all items
avoids doing such a comparison on an item with a parent reference. I
feel like I'm walking on thin ice here. :-/
Btw: another problem with cyclic data is that you are causing a retain
loop, and thus the data will never be released (because children
retain parents, so neither will ever get a retain count of zero).
Though it shouldn't crash ;)
Yeah, I'm aware of that risk.
--
Tom Harrington
email@hidden
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.