From abbde1c54325ff2a869d85a5e32d11d0f118e756 Mon Sep 17 00:00:00 2001 From: rfm Date: Fri, 4 Feb 2011 22:46:08 +0000 Subject: [PATCH] minor osx compatibility tweak git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@31999 72102866-910b-0410-8b05-ffd578937521 --- ChangeLog | 5 +++++ Source/NSConcretePointerFunctions.m | 19 +++++++++++++++++-- 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 3339bdb86..8553dc4e0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2011-02-04 Richard Frith-Macdonald + + * Source/NSConcretePointerFunctions.m: objects with weak memory should + not be retained. + 2011-02-03 Philippe Roussel * Source/NSPropertyList.m: Fix memory leaks. diff --git a/Source/NSConcretePointerFunctions.m b/Source/NSConcretePointerFunctions.m index eab712d51..c125ce7ed 100644 --- a/Source/NSConcretePointerFunctions.m +++ b/Source/NSConcretePointerFunctions.m @@ -225,7 +225,14 @@ relinquishRetainedMemory(const void *item, } else if (options & NSPointerFunctionsObjectPointerPersonality) { - _x.acquireFunction = acquireRetainedObject; + if (options & NSPointerFunctionsZeroingWeakMemory) + { + _x.acquireFunction = acquireExistingMemory; + } + else + { + _x.acquireFunction = acquireRetainedObject; + } _x.descriptionFunction = describeObject; _x.hashFunction = hashShifted; _x.isEqualFunction = equalDirect; @@ -253,12 +260,20 @@ relinquishRetainedMemory(const void *item, } else /* objects */ { - _x.acquireFunction = acquireRetainedObject; + if (options & NSPointerFunctionsZeroingWeakMemory) + { + _x.acquireFunction = acquireExistingMemory; + } + else + { + _x.acquireFunction = acquireRetainedObject; + } _x.descriptionFunction = describeObject; _x.hashFunction = hashObject; _x.isEqualFunction = equalObject; } + return self; }