retain count (Re: half-initialized objects during decoding (Re: Persistance))
retain count (Re: half-initialized objects during decoding (Re: Persistance))
- Subject: retain count (Re: half-initialized objects during decoding (Re: Persistance))
- From: email@hidden
- Date: Thu, 11 Oct 2001 09:07:04 -0400
Why is initWithCoder assuming that the retain count should
be initialized to 0? Is this how NSUnarchiver returns
autoreleased objects? In that case, something like x = [[X
alloc] initWithCoder:aCoder]; is also very wrong, since
everybody would assume that the retain count is 1.
most likely because an internal counter at 0 is a retainCount at 1.
and when an object with a counter at 0 receive a release, it doesn't
first reduce the retainCount but simply dealloc itself.
I've implemented internal retain count before, and they had that logic.
And I'm sure that objects that doesn't have internal retain count also
doesn't have a counter at all (no counter associated with that object)
to represent a retainCount at 1.
- jfv