• 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
bind, unbind and retainCount problems
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bind, unbind and retainCount problems


  • Subject: bind, unbind and retainCount problems
  • From: Julien Palmas <email@hidden>
  • Date: Tue, 26 Apr 2005 11:32:18 +0900

As I explained in a thread at the end of last week, I am using several nibs in my application to load views. Those nibs only have a NSView instance, no NSWindow instance.

After following the advices given by the list, I decided not to use a sub Class of NSWindowController as the fileOwner. The class I use as the fileOwner will then have to release, on dealloc, all the top level objects ....

But it looks like not using NSWindowController implies more trouble if you are also using bindings in the nib. The nib holds a NSArrayController that has its contentArray binded to an NSArray in the fileOwner. This binding sends a retain message to my fileOwner.

The final problem is that if I don't unbind this NSArrayController when the document closes, the nib fileowner will still have a retainCount of 1 because of the binding and will not be properly deallocated, causing quite a big memory leak !

I tried to send an unbind message to the NSArrayController, but it didn't seem to work, the fileowner didn't receive the corresponding release I was expecting.

Then, How should I do to remove that binding and finally remove this retainCount of 1 on the fileOwner ?

_______________________________________________
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


  • Follow-Ups:
    • Re: bind, unbind and retainCount problems
      • From: Scott Stevenson <email@hidden>
  • Prev by Date: Re: NSPanel newbie init question
  • Next by Date: Re: Document notifications?
  • Previous by thread: Re: Document notifications?
  • Next by thread: Re: bind, unbind and retainCount problems
  • Index(es):
    • Date
    • Thread