• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Question about NSTreeController/NSOutlineView instance cleanup
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Question about NSTreeController/NSOutlineView instance cleanup


  • Subject: Re: Question about NSTreeController/NSOutlineView instance cleanup
  • From: Markus Spoettl <email@hidden>
  • Date: Thu, 10 Apr 2008 23:01:52 -0700

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@hidden)

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:
This email sent to email@hidden


  • Follow-Ups:
    • Re: Question about NSTreeController/NSOutlineView instance cleanup
      • From: Quincey Morris <email@hidden>
References: 
 >Question about NSTreeController/NSOutlineView instance cleanup (From: Markus Spoettl <email@hidden>)
 >Re: Question about NSTreeController/NSOutlineView instance cleanup (From: Markus Spoettl <email@hidden>)
 >Re: Question about NSTreeController/NSOutlineView instance cleanup (From: Quincey Morris <email@hidden>)
 >Re: Question about NSTreeController/NSOutlineView instance cleanup (From: Markus Spoettl <email@hidden>)
 >Re: Question about NSTreeController/NSOutlineView instance cleanup (From: Quincey Morris <email@hidden>)

  • Prev by Date: Re: Making use of Core 2 features without 64bit addressing
  • Next by Date: Re: Making use of Core 2 features without 64bit addressing
  • Previous by thread: Re: Question about NSTreeController/NSOutlineView instance cleanup
  • Next by thread: Re: Question about NSTreeController/NSOutlineView instance cleanup
  • Index(es):
    • Date
    • Thread