Chromium Code Reviews| Index: chrome/browser/cocoa/objc_zombie.mm |
| diff --git a/chrome/browser/cocoa/objc_zombie.mm b/chrome/browser/cocoa/objc_zombie.mm |
| index a9d906395a1666fd33624abaa8de42fd457687d9..9a7c9630cc3b23b62f1e27d66f084a683d49f188 100644 |
| --- a/chrome/browser/cocoa/objc_zombie.mm |
| +++ b/chrome/browser/cocoa/objc_zombie.mm |
| @@ -144,12 +144,17 @@ void ZombieDealloc(id self, SEL _cmd) { |
| memset(self, '!', size); |
| // If the instance is big enough, make it into a fat zombie and have |
| - // it remember the old isa. Otherwise make it a regular zombie. |
| + // it remember the old |isa|. Otherwise make it a regular zombie. |
| + // Setting |isa| rather than using |object_setClass()| because that |
| + // function is implemented with a memory barrier. The runtime's |
| + // |_internal_object_dispose()| (in objc-class.m) does this, so it |
| + // should be safe (messaging free'd objects shouldn't be expected to |
| + // be thread-safe in the first place). |
| if (size >= g_fatZombieSize) { |
| - object_setClass(self, g_fatZombieClass); |
| + self->isa = g_fatZombieClass; |
| static_cast<CrFatZombie*>(self)->wasa = wasa; |
| } else { |
| - object_setClass(self, g_zombieClass); |
| + self->isa = g_zombieClass; |
|
Avi (use Gerrit)
2010/06/03 19:16:51
Huh. isa is still public in the objc2 runtime? If
Scott Hess - ex-Googler
2010/06/03 19:46:33
Not sure what you mean. struct objc_class has OBJ
|
| } |
| // The new record to swap into |g_zombies|. If |g_zombieCount| is |