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: Wed, 18 Sep 2002 15:18:13 +0200
On Tuesday, September 17, 2002, at 02:29 PM, Girard Iglesias wrote:
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--;
}
This hack is sufficient under Cocoa, but not under Gnustep ;)
Well, I feel that there is a problem with this kind of stuff when the
notification is autoreleased, in this case the notification release the
object and the message can't be sent, the object has been deallocated.
I understand that I need to change completely the strategy we use to
handle this kind of stuff :
Send the notification from the dealloc with the reference to the
object as a weak reference (Like in Java????) in the forma of a
[NSNumber numberWithUnsignedLong:(unsigned long)self]
But I very curious to know why all this stuff does work under Cocoa and
the YB/NT ????
Very interesting indeed.
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.