On Apr 10, 2008, at 8:48 PM, Quincey Morris wrote:
Perhaps the controller is not getting released when it should. Do you have an instance variable for the controller too? If so, how is that retained/released? You could probably avoid the error by sending a "setContent:nil" message to the controller in the document's dealloc, but that would just be papering over the problem.

Agreed. The NSTreeController does have an outlet on the NSDocument class but it's not retained/released there as it's managed through the nib management (at least that's what I thought).

Or perhaps the objects in treeContent are all getting overreleased. That could cause the error messages you're seeing.


Yes that must be it. I'm not sure how I manage to do that, though. Basically what I do is this:

NSIndexPath *location = [NSIndexPath indexPathWithIndex: [treeContent count]];

  TreeNode *rootnode = [[TreeNode alloc] init];
  ... set treenode properties ...

[treeController insertObject:rootnode atArrangedObjectIndexPath:location];

  ... do something that involves rootnode like adding sub-nodes ...

  [rootnode release]

The treeController will retain rootnode at the time insertObject is called and also adds rootnode to treeContent. Again, at least that's what I thought. There is no other place in the code that deals with or releases/retains TreeNode objects.

Regards
Markus
--
__________________________________________
Markus Spoettl

_______________________________________________

Cocoa-dev mailing list ([email protected])

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to