[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: setter/getter discussion
From: |
Pascal Bourguignon |
Subject: |
Re: setter/getter discussion |
Date: |
Tue, 6 Aug 2002 02:14:05 +0200 (CEST) |
> From: Pete French <pete@twisted.org.uk>
> Date: Tue, 06 Aug 2002 00:48:28 +0100
>
> [I lost the subject line, sorry!]
>
> The one thing that ouzzles me about all this is peoples suggestiong to
> use [[obj retain] autorelease] where the object 'obj' may already be
> in an autorelease pool. I didnt think it was legal to autorelease an
> object more than once ?
>
> -bat.
It is if the retain count is incremented before.
What should be ensured is that an object is not sent dealloc twice.
The autorelease pool sends dealloc to an object it has only if it's
retain count goes down to zero when it releases it.
So, if you retain the object, you can autorelease (release in the future).
--
__Pascal_Bourguignon__ http://www.informatimago.com/
----------------------------------------------------------------------