Dealloc notification stuff

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@5524 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Richard Frith-MacDonald 1999-12-15 17:31:01 +00:00
parent 5837aeb214
commit c06187dbf2
3 changed files with 41 additions and 3 deletions

View file

@ -1,3 +1,8 @@
Wed Dec 15 17:30:00 1999 Richard Frith-Macdonald <richard@brainstorm.co.uk>
* Source/Foundation/NSObject.h: dealloc notification stuff for Helge
* Source/NSObject.m: dealloc notification stuff for Helge
Wed Dec 15 2:18:00 1999 Richard Frith-Macdonald <richard@brainstorm.co.uk>
* Source/UnixFileHandle.m: Chck to see if we are given a bad address.

View file

@ -184,13 +184,24 @@ extern NSRecursiveLock *gnustep_global_lock;
indent: (unsigned)level
to: (id<GNUDescriptionDestination>)output;
- (Class)transmuteClassTo:(Class)aClassObject;
- subclassResponsibility:(SEL)aSel;
- shouldNotImplement:(SEL)aSel;
- subclassResponsibility: (SEL)aSel;
- shouldNotImplement: (SEL)aSel;
+ (Class) autoreleaseClass;
+ (void) setAutoreleaseClass: (Class)aClass;
+ (void) enableDoubleReleaseCheck: (BOOL)enable;
- read: (TypedStream*)aStream;
- write: (TypedStream*)aStream;
/*
* If the 'deallocActivationsActive' flag is set, the _dealloc method will be
* called during the final release of an object, and the dealloc method will
* then be called only if _dealloc returns YES.
* You can override the _dealloc implementation to perform some action before
* an object is deallocated (or disable deallocation by returning NO).
* The default implementation simply returns YES.
*/
- (BOOL) deallocNotificationsActive;
- (void) setDeallocNotificationsActive: (BOOL)flag;
- (BOOL) _dealloc;
@end
/*

View file

@ -661,6 +661,23 @@ static BOOL double_release_check_enabled = NO;
NSDeallocateObject (self);
}
static BOOL deallocNotifications = NO;
- (BOOL) deallocNotificationsActive
{
return deallocNotifications;
}
- (void) setDeallocNotificationsActive: (BOOL)flag
{
deallocNotifications = flag;
}
- (BOOL) _dealloc
{
return YES;
}
- free
{
[NSException raise: NSGenericException
@ -1029,7 +1046,12 @@ static BOOL double_release_check_enabled = NO;
}
if (NSDecrementExtraRefCountWasZero(self))
[self dealloc];
{
if (deallocNotifications == NO || [self _dealloc] == YES)
{
[self dealloc];
}
}
#endif
}