Calling -retain inside -dealloc
Calling -retain inside -dealloc
- Subject: Calling -retain inside -dealloc
- From: Andrew Garber <email@hidden>
- Date: Sun, 26 Jun 2005 18:51:30 -0700
Hi all! Here's the situation:
I have a class variable, an NSMutableArray, which is storing instances
of the class. Why I'm doing this is quite complex, so I won't get into
the details. Whenever my object's -init is called, I call
NSMutableArray's -addObject, then release my object (so that the
retain count stays the same). 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?
Thanks,
Andrew
_______________________________________________
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