Bug with NSTreeController
Bug with NSTreeController
- Subject: Bug with NSTreeController
- From: Alexander Hartner <email@hidden>
- Date: Sun, 12 Mar 2006 00:25:43 +0000
I starting getting crashes with NSTreeController. My application
started crashing constently with *** -[NSCFArray objectAtIndex:]:
index (x) beyond bounds (x). After some searching I came across the
following link
http://www.cocoadev.com/index.pl?search=NSTreeControllerBug
What you have to do is to use a subclass of NSTreeController and
overwrite the setContent methods as follows.
- (void)setContent:(id)content
{
if(![content isEqual:[self content]])
{
NSArray *paths = [[self selectionIndexPaths] retain];
[super setContent:nil];
[super setContent:content];
[self setSelectionIndexPaths:paths];
[paths release];
}
}
The site seems to suggest that this bug was isolated to 10.4.3, but I
am using 10.4.5 and was experiencing the same problem. I was
wondering if this is an actual bug, or if I am doing something
wrong. I tried my best to debug this further, without much success.
After I implemented the suggested solution, the application did not
crash anymore.
Thanks for any feedback.
Alexander Hartner
email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden