Re: NSEnumerator retaining objects?
Re: NSEnumerator retaining objects?
- Subject: Re: NSEnumerator retaining objects?
- From: Marco Scheurer <email@hidden>
- Date: Wed, 9 Mar 2005 20:55:21 +0100
On Mar 9, 2005, at 20:46, Chris Kane wrote:
3) The enumerator class does NOT retain/autorelease every object
returned from -nextObject. Marco's test case was too trivial to
observe the real behavior: only the last object from the enumeration
is retained/autoreleased, as -nextObject returns the last object. In
Marco's test, there was only one object in the collection, so it was
the one that got retained/autoreleased. The retain/autorelease is
required because the collection is released in the same call, so the
object could go away if the collection held the only retain.
Thanks, I'm relieved! And that's a good lesson, I should have thought
of the last one being a special case.
Marco Scheurer
Sen:te, Lausanne, Switzerland http://www.sente.ch
_______________________________________________
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