Re: Notification from dealloc and overiding retain/release scheme
Re: Notification from dealloc and overiding retain/release scheme
- Subject: Re: Notification from dealloc and overiding retain/release scheme
- From: Gérard Iglesias <email@hidden>
- Date: Tue, 17 Sep 2002 14:29:49 +0200
On Tuesday, September 17, 2002, at 01:59 PM, Girard Iglesias wrote:
>
if the release is coded like :
>
>
- (void)release
>
{
>
refCount--;
>
if (refCount == 0)
>
[self dealloc];
>
}
I just have the idea to implement the release as :
- (void)release
{
if (itsReferenceCount == 1)
[self dealloc];
else
itsReferenceCount--;
}
I decrement the ref count if the object is not deallocated, by this way
I resolve the specific problem I have, but I am not very happy with
that.
I have the idea because when you are in the dealloc of an object you
see that the ref count is 1, strange for me ?
Looking at the Gnustep code I seee that they are doing almost the same,
but with the zero value, i.e. if an object have its ref count equal to
zero when it receive the release message, then it deallocate itself,
but doesn't decrement the value.
What do you think of that ?
Regards
Gerard
_______________________________________________
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.