• 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
Confused on releasing bindings in doc-based apps
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Confused on releasing bindings in doc-based apps


  • Subject: Confused on releasing bindings in doc-based apps
  • From: Mike Abdullah <email@hidden>
  • Date: Thu, 23 Mar 2006 01:11:37 +0000

I am trying to get my head round how I should carry out the whole object releasing process with bindings in my document based app. I've read lots of documentation on bindings, but I can't quite seem to fully understand this part of the jigsaw.

So, I have a document based app. In the document nib file I have something like:

===========	============	===============	===================
File's owner		Document Data	Document Window	Object Controller
MyDocument										(content set to doc data)
===========	============	===============	===================

Now several items in the document window are bound to the document data and this works fine. When I close the document, all these items in the NIB are released. I don't get how! Who releases them? I assume it is NSDocument, but how exactly does it know about these items in my nib when I haven't told it about them?

But anyway, on to the real problem. One of the key values of document data is an array of a custom object of mine. I have an NSArrayController bound to this. The thing is, I want to have each of these custom objects in the array to set itself as a key value observer of a different property of document data.

I can set this KVO relationship up nicely. The problem comes when closing the document. Basically, I get an error in the log saying that an object is being deallocated whilst it is being observed by something. So what is the correct method for getting my deallocation in the right order?

At present, what seems to happen, is the document data is deallocated. In it's deallocation stuff, it releases the array of custom objects it contains. In the custom object's deallocation it removes the KVO. Of course when the KVO is removed, the deallocation of the document data (which is what it is observing) has already started, so the program throws a wobbly.

err, help! please :)

Mike A.
_______________________________________________
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


  • Prev by Date: Re: awakeFromNib vs appdidfinishlaunching
  • Next by Date: Re: Useless side remark...
  • Previous by thread: Re: NSImageView in IB
  • Next by thread: NSTimer fires after invalidated - why?
  • Index(es):
    • Date
    • Thread