mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-06-01 20:21:57 +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
c51012e260
commit
3be0c5db02
1 changed files with 8 additions and 4 deletions
|
@ -35,12 +35,15 @@
|
||||||
static Class abstract;
|
static Class abstract;
|
||||||
static Class concrete;
|
static Class concrete;
|
||||||
|
|
||||||
|
static NSNotificationCenter *nc = nil;
|
||||||
|
|
||||||
+ (void) initialize
|
+ (void) initialize
|
||||||
{
|
{
|
||||||
if (self == [NSTextStorage class])
|
if (self == [NSTextStorage class])
|
||||||
{
|
{
|
||||||
abstract = self;
|
abstract = self;
|
||||||
concrete = [GSTextStorage class];
|
concrete = [GSTextStorage class];
|
||||||
|
nc = [NSNotificationCenter defaultCenter];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -55,6 +58,11 @@ static Class concrete;
|
||||||
- (void) dealloc
|
- (void) dealloc
|
||||||
{
|
{
|
||||||
RELEASE (_layoutManagers);
|
RELEASE (_layoutManagers);
|
||||||
|
if (_delegate != nil)
|
||||||
|
{
|
||||||
|
[nc removeObserver: _delegate name: nil object: self];
|
||||||
|
_delegate = nil;
|
||||||
|
}
|
||||||
[super dealloc];
|
[super dealloc];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -178,8 +186,6 @@ static Class concrete;
|
||||||
int i;
|
int i;
|
||||||
unsigned length;
|
unsigned length;
|
||||||
|
|
||||||
NSNotificationCenter* nc = [NSNotificationCenter defaultCenter];
|
|
||||||
|
|
||||||
NSDebugLLog(@"NSText", @"processEditing called in NSTextStorage.");
|
NSDebugLLog(@"NSText", @"processEditing called in NSTextStorage.");
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -260,8 +266,6 @@ static Class concrete;
|
||||||
*/
|
*/
|
||||||
- (void) setDelegate: (id)anObject
|
- (void) setDelegate: (id)anObject
|
||||||
{
|
{
|
||||||
NSNotificationCenter* nc = [NSNotificationCenter defaultCenter];
|
|
||||||
|
|
||||||
if (_delegate)
|
if (_delegate)
|
||||||
[nc removeObserver: _delegate name: nil object: self];
|
[nc removeObserver: _delegate name: nil object: self];
|
||||||
_delegate = anObject;
|
_delegate = anObject;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue