mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-04-23 15:11:37 +00:00
Remove the delegate from the notification center in -dealloc; cache the
default notification center git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@14530 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
03c108664b
commit
33da6f7f1c
1 changed files with 8 additions and 4 deletions
|
@ -35,12 +35,15 @@
|
|||
static Class abstract;
|
||||
static Class concrete;
|
||||
|
||||
static NSNotificationCenter *nc = nil;
|
||||
|
||||
+ (void) initialize
|
||||
{
|
||||
if (self == [NSTextStorage class])
|
||||
{
|
||||
abstract = self;
|
||||
concrete = [GSTextStorage class];
|
||||
nc = [NSNotificationCenter defaultCenter];
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -55,6 +58,11 @@ static Class concrete;
|
|||
- (void) dealloc
|
||||
{
|
||||
RELEASE (_layoutManagers);
|
||||
if (_delegate != nil)
|
||||
{
|
||||
[nc removeObserver: _delegate name: nil object: self];
|
||||
_delegate = nil;
|
||||
}
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
|
@ -178,8 +186,6 @@ static Class concrete;
|
|||
int i;
|
||||
unsigned length;
|
||||
|
||||
NSNotificationCenter* nc = [NSNotificationCenter defaultCenter];
|
||||
|
||||
NSDebugLLog(@"NSText", @"processEditing called in NSTextStorage.");
|
||||
|
||||
/*
|
||||
|
@ -260,8 +266,6 @@ static Class concrete;
|
|||
*/
|
||||
- (void) setDelegate: (id)anObject
|
||||
{
|
||||
NSNotificationCenter* nc = [NSNotificationCenter defaultCenter];
|
||||
|
||||
if (_delegate)
|
||||
[nc removeObserver: _delegate name: nil object: self];
|
||||
_delegate = anObject;
|
||||
|
|
Loading…
Reference in a new issue