Re: Calling -retain inside -dealloc
Re: Calling -retain inside -dealloc
- Subject: Re: Calling -retain inside -dealloc
- From: Fritz Anderson <email@hidden>
- Date: Sun, 26 Jun 2005 22:15:18 -0500
On 26 Jun 2005, at 8:51 PM, Andrew Garber wrote:
Inside my object's -dealloc method, I
first retain self, then call NSMutableArray's -removeObject.
So, the retain count is zero when entering the -dealloc method, then
it gets incremented to 1, then it gets decremented back to zero.
Is there any risk that when the retain count drops to zero the second
time, -dealloc will be called again, causing an endless loop?
You could try it yourself. My guess is that it would loop endlessly,
and that if it didn't it would be an incident of implementation that
could not be relied on.
How about overriding -release so that if a call to -[super release]
leaves the retain count at 1, you remove self from the index list?
-- F
_______________________________________________
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