Extra retain count from loading nib with bindings
Extra retain count from loading nib with bindings
- Subject: Extra retain count from loading nib with bindings
- From: Rick Hoge <email@hidden>
- Date: Tue, 27 Jul 2004 14:33:41 -0400
I have noticed that when I load a nib using loadNibNamed:owner: I get
extra retain counts.
For example
[NSBundle loadNibNamed:@"Progress" owner:self];
Bumps the retain count of 'self' by three. One retain is balanced by a
release when I close the window associated with the bundle, and the
other two seem to be caused by bindings in the nib file. Because the
two retains from the bindings are not balanced, my object is never
deallocated and I leak memory.
Obviously this is a problem, and seems to be a known feature (e.g.
http://www.cocoadev.com/index.pl?NSBundle).
Is there an acknowledged best workaround for this? I can think of
several kludges, all of which are kind of ugly. For example I could
check the retain count immediately before and after loading the nib,
and send an extra release for every extra retain count when I close the
nib...
Any suggestions on how to deal with this would be very welcome.
Rick
_______________________________________________
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.