[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: sending notifications in -dealloc
From: |
Richard Frith-Macdonald |
Subject: |
Re: sending notifications in -dealloc |
Date: |
Sat, 1 Jun 2002 06:10:49 +0100 |
On Friday, May 31, 2002, at 04:21 PM, Helge Hess wrote:
Richard Frith-Macdonald wrote:
Perhaps NSDecrementExtraRefCountWasZero() and
NSIncrementExtraRefCount() should simply not
operate once the extra ref count goes to (unsigned)-1 (with the
former returning NO) ?
Hm, I'm unsure about that. I'll check MacOSX. Even though I don't
remember that I have written this somewhere, I could imagine code which
essentially does that:
- (void)dealloc {
if ([self shouldCache]) {
[MyCache addObject:self];
return;
}
[super dealloc];
}
That is, the reference count really is raised up again and the
deallocation is canceled. I'm aware that this is very dangerous
(especially with subclassing) ...
I'll check MacOSX ...
I've just done that ... it seems that the behavior is simply that
NSDecrementExtraRefCountWasZero() does *NOT*
decrement the extra ref count if it was zero.
I've changed the base library to do the same, and documented the
function and the -release method to describe
how they *actually* behave.
This allows the behavior you describe above, since it is now impossible
for a retainCount to become zero.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Re: sending notifications in -dealloc,
Richard Frith-Macdonald <=