Re: Is Apple's singleton sample code correct?
Re: Is Apple's singleton sample code correct?
- Subject: Re: Is Apple's singleton sample code correct?
- From: David Gimeno Gost <email@hidden>
- Date: Wed, 30 Nov 2005 02:09:48 +0100
On 29 Nov 2005, at 23:58, Andreas Mayer wrote:
I'm not saying that everyone should use object deallocation to do
resource cleanup, I'm just saying that there is nothing wrong about
doing things that way,
It's wrong when you are using Cocoa because you can't be sure that
dealloc will be called at all.
Sending an additional release won't help since there might be other
objects that are still holding on to the object in question.
And this is exactly the behavior that I would expect. Either those
other objects are also released or they aren't. If they are, their
-dealloc method shall send the required -release message. If they
aren't, that would be a bug in my code, not an incompatibility with the
Cocoa model.
Note also that for this to happen to a singleton, it requires that the
object that is retaining it is ignoring the fact that it is a
singleton.
It's best to not fight the framework. To do so will make your life
miserable.
Agreed, but that's not the case.
Regards.
_______________________________________________
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