mirror of
https://github.com/gnustep/libs-base.git
synced 2025-04-22 16:33:29 +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
|
@ -1,6 +1,5 @@
|
|||
2011-02-11 Richard Frith-Macdonald <rfm@gnu.org>
|
||||
|
||||
* Source/NSUserDefaults.m:
|
||||
* Source/NSArray.m:
|
||||
* Source/NSString.m:
|
||||
* Source/NSPointerArray.m:
|
||||
|
@ -8,6 +7,8 @@
|
|||
Tweaks to try to avoid clang analyser warnings.
|
||||
* Source/NSPropertyList.m:
|
||||
Revert last change.
|
||||
* Source/NSObject.m:
|
||||
Rewrite zombie setup code to avoid crashes caused by latest change.
|
||||
|
||||
2011-02-11 Stefan Bidigaray <stefanbidi@gmail.com>
|
||||
|
||||
|
|
|
@ -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…
Reference in a new issue