NSBundle won't release ?
NSBundle won't release ?
- Subject: NSBundle won't release ?
- From: Dirk van Oosterbosch <email@hidden>
- Date: Mon, 18 Apr 2005 15:28:28 +0200
Hi all,
I am witnessing a strange behavior with the (not) release of NSBundle. It seems it doesn't want to be released, period. No matter how many -release(s) you send it.
I am using
setBundle:[NSBundle bundleWithPath:bundlePath]];
and the accessor method
- (void)setBundle:(NSBundle *)aBundle
{
[aBundle retain];
[bundle release];
bundle = aBundle;
}
But the
[self setBundle:nil]; from my -dealloc doesn't actually release it.
I am using this NSBundle as my document base type (meaning my NSDocument-subclass owns a MyOwnBundle instance -from which the code above stems- which owns a NSBundle). But everytime I open / close / open / cl... the same document, I am seeing the first state of that document, regardless of whether I changed it behind the applications back. I am NSLogging the bundle's -retaincount and every time I set the bundle using the above +bundleWithPath method, and using the same bundlePath, I see my retain count explode: 8, 32, 128, 384, 640, 896, 1152. This can't be right.
in this old thread http://www.cocoabuilder.com/archive/message/cocoa/2001/11/24/43545 Ondra Cada says "
rather, unless you really need to do that, don't retain the result of bundleWithPath"
Well, I guess I am. But what are my alternatives?
Are there other things I should do to get the bundle? Or are there alternatives to releasing it?
Thanks,
Dirk van Oosterbosch
-----------------------------
Dirk van Oosterbosch
de Wittenstraat 225
1052 AT Amsterdam
the Netherlands
T ++ 31 20 7765565
M ++ 31 6 48401910
W http://labs.ixopusada.com
-----------------------------
_______________________________________________
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