loadNibNamed, Bindings and retain count
loadNibNamed, Bindings and retain count
- Subject: loadNibNamed, Bindings and retain count
- From: "Andrew Mellinger" <email@hidden>
- Date: Wed, 12 Oct 2005 14:03:36 -0400
- Thread-topic: loadNibNamed, Bindings and retain count
Greetings!
I am having a problem with the retain count of three on my window controller (subclass of NSWindowController). I have a nib (not MainMenu) that I am loading. There is one outlet from File's Owner to the instantiated window controller. Other controllers (like array controllers) bind to the window controller, and the window controller is a delegate of the window (delegates shouldn't matter as simply being a delegate isn't supposed to increase the retain count). The window controller has an outlet to the window.
I've gone through a ton of docs. When reading the article on window closing:
http://developer.apple.com/documentation/Cocoa/Conceptual/Documents/Concepts/WindowClosingBehav.html
It indicates "When a window controller does not have an associated document..." "... must be retained by some other object." At this point because I have three retains already, this doesn't make sense. I have two too many, why would I add another one?
In my overall app controller I have the following:
[NSBundle loadNibNamed: @"DocWindow" owner: self];
My outlet is set up properly to the window controller, except is has a retain count of three.
I've put in my own retain/release methods so I can put breakpoints on them. Those retain counts are NOT autoreleased waiting to be released, they hang around. One must be coming from the init, the others are both from something in the bindings. The stack....
#0 0x000049b0 in -[DCEWindowController retain] at DCEWindowController.mm:339
#1 0x92935534 in -[NSKeyValueArray _proxyInitWithContainer:getter:]
#2 0x92910d28 in _NSGetProxyValueWithGetterNoLock
#3 0x92910b74 in _NSGetProxyValueWithGetter
#4 0x928e0200 in _NSGetUsingKeyValueGetter
#5 0x92892e60 in -[NSObject(NSKeyValueCoding) valueForKeyPath:]
#6 0x9384dad0 in -[NSBinder _valueForKeyPath:ofObject:mode:raisesForNotApplicableKeys:]
#7 0x9384d76c in -[NSBinder valueForBinding:resolveMarkersToPlaceholders:]
#8 0x938744f0 in -[NSArrayDetailBinder _refreshDetailContentInBackground:]
#9 0x93845648 in -[NSObject(NSKeyValueBindingCreation) bind:toObject:withKeyPath:options:]
#10 0x9363dbac in -[NSIBObjectData nibInstantiateWithOwner:topLevelObjects:]
#11 0x93629fc4 in loadNib
#12 0x93629a1c in +[NSBundle(NSNibLoading) _loadNibFile:nameTable:withZone:ownerBundle:]
#13 0x93680cfc in +[NSBundle(NSNibLoading) loadNibFile:externalNameTable:withZone:]
#14 0x93710ab0 in +[NSBundle(NSNibLoading) loadNibNamed:owner:]
#15 0x000054c8 in -[DCEToolController openDoc:] at DCEToolController.mm:40
So what are these things that are generating retains? And how do I get rid of this so I don't leak document windows?
At this point I'm pretty boggled. I can't follow the directions in about closing windows because they don't work. I suppose next I'll need to start reading through the intermediate assembly. Is there anyone there who has access to the source who could shed some light on this?
Thanks,
Andrew
_______________________________________________
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