Re: Add same object/key to NSMapTable
Re: Add same object/key to NSMapTable
- Subject: Re: Add same object/key to NSMapTable
- From: Jim Correia <email@hidden>
- Date: Wed, 17 Jun 2009 22:10:47 -0400
On Wed, Jun 17, 2009 at 9:51 PM, Bill Bumgarner <email@hidden> wrote:
> You can't assume that the container didn't make a copy or do something else.
>
> If you need the object, you should hold a retain.
In general, I agree. However, the following code is also problematic:
[o release];
[testTable setObject:[testTable objectForKey:k] forKey:k];
NSDictionary does not have the same failure mode. Bug in NSMapTable
(for the edge case of replacing the current value)?
- Jim
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden