mirror of
https://github.com/gnustep/libs-base.git
synced 2025-06-01 09:02:01 +00:00
NSZombie fixups
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@32051 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
37f65fb873
commit
594a654252
2 changed files with 18 additions and 9 deletions
|
@ -127,15 +127,22 @@ BOOL NSZombieEnabled = NO;
|
|||
BOOL NSDeallocateZombies = NO;
|
||||
|
||||
@class NSZombie;
|
||||
static Class zombieClass;
|
||||
static NSMapTable *zombieMap;
|
||||
static NSMapTable *zombieMap = 0;
|
||||
|
||||
#if !GS_WITH_GC
|
||||
static void GSMakeZombie(NSObject *o)
|
||||
{
|
||||
Class c = ((id)o)->class_pointer;
|
||||
static Class zombieClass = Nil;
|
||||
Class c;
|
||||
|
||||
((id)o)->class_pointer = zombieClass;
|
||||
if (nil == zombieClass)
|
||||
{
|
||||
zombieMap = NSCreateMapTable(NSNonOwnedPointerMapKeyCallBacks,
|
||||
NSNonOwnedPointerMapValueCallBacks, 0);
|
||||
zombieClass = [NSZombie class];
|
||||
}
|
||||
c = object_getClass(o);
|
||||
object_setClass(o, zombieClass);
|
||||
if (NSDeallocateZombies == NO)
|
||||
{
|
||||
[allocationLock lock];
|
||||
|
@ -961,18 +968,19 @@ objc_create_block_classes_as_subclasses_of(Class super) __attribute__((weak));
|
|||
GSObjCBehaviorDebug(GSPrivateEnvironmentFlag("GNUSTEP_BEHAVIOR_DEBUG",
|
||||
GSObjCBehaviorDebug(-1)));
|
||||
|
||||
// Zombie management stuff.
|
||||
zombieMap = NSCreateMapTable(NSNonOwnedPointerMapKeyCallBacks,
|
||||
NSNonOwnedPointerMapValueCallBacks, 0);
|
||||
zombieClass = NSClassFromString(@"NSZombie");
|
||||
// Zombie management flags.
|
||||
NSZombieEnabled = GSPrivateEnvironmentFlag("NSZombieEnabled", NO);
|
||||
NSDeallocateZombies = GSPrivateEnvironmentFlag("NSDeallocateZombies", NO);
|
||||
|
||||
// Set up the autorelease system
|
||||
autorelease_class = [NSAutoreleasePool class];
|
||||
autorelease_sel = @selector(addObject:);
|
||||
autorelease_imp = [autorelease_class methodForSelector: autorelease_sel];
|
||||
|
||||
// Make sure the constant string class works.
|
||||
NSConstantStringClass = [NSString constantStringClass];
|
||||
GSPrivateBuildStrings();
|
||||
|
||||
[[NSNotificationCenter defaultCenter]
|
||||
addObserver: self
|
||||
selector: @selector(_becomeMultiThreaded:)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue