Re: binding causing retain loop?
Re: binding causing retain loop?
- Subject: Re: binding causing retain loop?
- From: "Dennis C. De Mars" <email@hidden>
- Date: Fri, 30 Jul 2004 08:51:43 -0700
Yes, your are right. This is a problem. If you look in the cocoa-dev
archives you can find threads on the subject with the following titles:
Retain cycle problem with bindings & NSWindowController
Who should release whom in a document-based app?
,,,and there are probably more.
Basically, if the File's Owner is a window controller, any binding that
uses a key path that goes through the File's Owner causes a retain
cycle.
The workaround I use is to make sure that no key path goes through the
File's Owner in this case. I do this by creating an NSObjectController
in the nib file and sending all key paths thought it. I have to
programatically set the NSObjectController to point to the desired
model objects when the nib is instantiated. See the second thread
referenced above for more details.
- Dennis D.
On Jul 30, 2004, at 8:13 AM, Olivier Destrebecq wrote:
I have a window controller which is the owner of the file. I have some
array controller which have their content bound through the window
controller and also various other item bound through the file owner.
All works fine until it is time to close the window. In the window
controllers windowWill close method, i call [self autorelease] in the
hope to release the controller and all associated object, but at that
point the retain count is 13... I break on retain and notice that all
the binding i have through the window controller retained it. But
those are not released later on, i set a breakpoint on release and
autorelease and it was not called by the bindings.
So basically my window and its controller are never released :-(
any thought
Olivier
http://www-personal.si.umich.edu/~olivier/home/
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.