mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-04-23 20:01:11 +00:00
Remove the delegate from the notification center in -dealloc; cache the
default notification center for the whole class git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@14527 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
48cac53701
commit
c7976b098c
1 changed files with 14 additions and 4 deletions
|
@ -50,8 +50,15 @@
|
|||
|
||||
#include "AppKit/DPSOperators.h"
|
||||
|
||||
NSNotificationCenter *nc = nil;
|
||||
|
||||
@implementation NSSplitView
|
||||
|
||||
+ (void) initialize
|
||||
{
|
||||
nc = [NSNotificationCenter defaultCenter];
|
||||
}
|
||||
|
||||
/*
|
||||
* Instance methods
|
||||
*/
|
||||
|
@ -77,6 +84,13 @@
|
|||
RELEASE(_backgroundColor);
|
||||
RELEASE(_dividerColor);
|
||||
RELEASE(_dimpleImage);
|
||||
|
||||
if (_delegate != nil)
|
||||
{
|
||||
[nc removeObserver: _delegate name: nil object: self];
|
||||
_delegate = nil;
|
||||
}
|
||||
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
|
@ -103,7 +117,6 @@
|
|||
unsigned int eventMask = NSLeftMouseUpMask | NSLeftMouseDraggedMask;
|
||||
/* YES if delegate implements splitView:constrainSplitPosition:ofSubviewAt:*/
|
||||
BOOL delegateConstrains = NO;
|
||||
NSNotificationCenter *nc = [NSNotificationCenter defaultCenter];
|
||||
SEL constrainSel =
|
||||
@selector(splitView:constrainSplitPosition:ofSubviewAt:);
|
||||
IMP constrainImp;
|
||||
|
@ -601,7 +614,6 @@
|
|||
|
||||
- (void) adjustSubviews
|
||||
{
|
||||
NSNotificationCenter *nc = [NSNotificationCenter defaultCenter];
|
||||
NSArray *subs = [self subviews];
|
||||
unsigned count = [subs count];
|
||||
NSView *views[count];
|
||||
|
@ -857,8 +869,6 @@ static inline NSPoint centerSizeInRect(NSSize innerSize, NSRect outerRect)
|
|||
|
||||
- (void) setDelegate: (id)anObject
|
||||
{
|
||||
NSNotificationCenter* nc = [NSNotificationCenter defaultCenter];
|
||||
|
||||
if (_delegate)
|
||||
{
|
||||
[nc removeObserver: _delegate name: nil object: self];
|
||||
|
|
Loading…
Reference in a new issue