The following (simplified test case) code will crash with NSZombieEnabled:

NSMapTable* testTable = [NSMapTable mapTableWithStrongToStrongObjects];
NSString* o = [@"test_object" mutableCopy];
NSString* k = @"test_key";
[testTable setObject:o forKey:k];
[o release];
[testTable setObject:o forKey:k];       // crash

What seems to be happening is that -[NSMapTable setObject:forKey:] does a plain release on the key's "old" object before retaining the "new" object. This can result in the situation above, where the retain of the "new" object is performed on a zombie created by the release of the (identical) "old".

I could find no documentation to the effect that re-assigning an object is not allowed, so can I assume this is indeed unintentional? If so, I've got this test case in project form and would be happy to file a bug.

thanks,
-natevw
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to