mirror of
https://github.com/gnustep/libs-base.git
synced 2025-05-20 20:26:42 +00:00
More tweaks for garbage collection mode, including making NSNotificationCenter use weak pointers (things are never removed if it uses strong pointers because they remove themselves in the -dealloc method, which is never called, and can't remove themselves in the -finalize method because the -finalize method would not be called until after they have been removed - this is consistent with Apple behaviour).
Gorm now works correctly when built with GC enabled. git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@33109 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
a439972605
commit
b08b2d0f34
7 changed files with 20 additions and 26 deletions
|
@ -494,7 +494,7 @@ NSDecrementExtraRefCountWasZero(id anObject)
|
|||
inline NSUInteger
|
||||
NSExtraRefCount(id anObject)
|
||||
{
|
||||
#if GS_WITH_GC
|
||||
#if GS_WITH_GC || __OBJC_GC__
|
||||
return UINT_MAX - 1;
|
||||
#else /* GS_WITH_GC */
|
||||
return ((obj)anObject)[-1].retained;
|
||||
|
@ -1723,7 +1723,7 @@ objc_create_block_classes_as_subclasses_of(Class super);
|
|||
*/
|
||||
- (id) autorelease
|
||||
{
|
||||
#if GS_WITH_GC == 0
|
||||
#if !GS_WITH_GC && !__OBJC_GC__
|
||||
if (double_release_check_enabled)
|
||||
{
|
||||
NSUInteger release_count;
|
||||
|
@ -1935,7 +1935,7 @@ objc_create_block_classes_as_subclasses_of(Class super);
|
|||
*/
|
||||
- (oneway void) release
|
||||
{
|
||||
#if GS_WITH_GC == 0 && !__OBJC_GC__
|
||||
#if (GS_WITH_GC == 0) && !__OBJC_GC__
|
||||
if (NSDecrementExtraRefCountWasZero(self))
|
||||
{
|
||||
[self dealloc];
|
||||
|
@ -1985,7 +1985,7 @@ objc_create_block_classes_as_subclasses_of(Class super);
|
|||
*/
|
||||
- (id) retain
|
||||
{
|
||||
#if GS_WITH_GC == 0 && !__OBJC_GC__
|
||||
#if (GS_WITH_GC == 0) && !__OBJC_GC__
|
||||
NSIncrementExtraRefCount(self);
|
||||
#endif
|
||||
return self;
|
||||
|
@ -2012,7 +2012,7 @@ objc_create_block_classes_as_subclasses_of(Class super);
|
|||
*/
|
||||
- (NSUInteger) retainCount
|
||||
{
|
||||
#if GS_WITH_GC
|
||||
#if GS_WITH_GC || __OBJC_GC__
|
||||
return UINT_MAX;
|
||||
#else
|
||||
return NSExtraRefCount(self) + 1;
|
||||
|
@ -2042,7 +2042,7 @@ objc_create_block_classes_as_subclasses_of(Class super);
|
|||
*/
|
||||
- (NSZone*) zone
|
||||
{
|
||||
#if GS_WITH_GC
|
||||
#if GS_WITH_GC || __OBJC_GC__
|
||||
/* MacOS-X 10.5 seems to return the default malloc zone if GC is enabled.
|
||||
*/
|
||||
return NSDefaultMallocZone();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue