mirror of
https://github.com/gnustep/libs-base.git
synced 2025-04-23 00:41:02 +00:00
Updates for revised NSNotificationCenter
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@4416 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
4126859bd5
commit
aa2e15e6f5
6 changed files with 62 additions and 43 deletions
|
@ -1,3 +1,12 @@
|
|||
Thu Jun 17 12:00:00 1999 Richard Frith-Macdonald <richard@brainstorm.co.uk>
|
||||
|
||||
* Tools/gdnc.m: Only use OpenStep NSNotificationCenter methods.
|
||||
* Source/NSConnection.m: ditto
|
||||
* Source/NSDistributedNotificationCenter.m: ditto
|
||||
* Source/NSPort.m: ditto
|
||||
* Source/NSPortNameServer.m: ditto
|
||||
* Source/NSSerializer.m: ditto
|
||||
|
||||
Mon Jun 14 10:20:00 1999 Richard Frith-Macdonald <richard@brainstorm.co.uk>
|
||||
|
||||
* Source/NSConcreteValue.m: Update for MacOS-X and for GC
|
||||
|
|
|
@ -466,7 +466,7 @@ static int messages_received_count;
|
|||
/*
|
||||
* Don't need notifications any more - so remove self as observer.
|
||||
*/
|
||||
[NSNotificationCenter removeObserver: self];
|
||||
[[NSNotificationCenter defaultCenter] removeObserver: self];
|
||||
|
||||
/*
|
||||
* We can't be the ancestor of anything if we are invalid.
|
||||
|
@ -511,8 +511,9 @@ static int messages_received_count;
|
|||
{
|
||||
NSAutoreleasePool *arp = [NSAutoreleasePool new];
|
||||
|
||||
[NSNotificationCenter postNotificationName: NSConnectionDidDieNotification
|
||||
object: self];
|
||||
[[NSNotificationCenter defaultCenter]
|
||||
postNotificationName: NSConnectionDidDieNotification
|
||||
object: self];
|
||||
[arp release];
|
||||
}
|
||||
}
|
||||
|
@ -1056,7 +1057,7 @@ static int messages_received_count;
|
|||
NSHashInsert(connection_table, (void*)newConn);
|
||||
[connection_table_gate unlock];
|
||||
|
||||
[NSNotificationCenter
|
||||
[[NSNotificationCenter defaultCenter]
|
||||
postNotificationName: NSConnectionDidInitializeNotification
|
||||
object: newConn];
|
||||
|
||||
|
|
|
@ -325,11 +325,11 @@ static NSDistributedNotificationCenter *defCenter = nil;
|
|||
/*
|
||||
* Ask to be told if the copnnection goes away.
|
||||
*/
|
||||
[NSNotificationCenter
|
||||
addObserver: self
|
||||
selector: @selector(_invalidated:)
|
||||
name: NSConnectionDidDieNotification
|
||||
object: c];
|
||||
[[NSNotificationCenter defaultCenter]
|
||||
addObserver: self
|
||||
selector: @selector(_invalidated:)
|
||||
name: NSConnectionDidDieNotification
|
||||
object: c];
|
||||
[remote registerClient: (id<GDNCClient>)self];
|
||||
}
|
||||
else
|
||||
|
@ -376,9 +376,10 @@ NSLog(@"Connection to GDNC server established.\n");
|
|||
/*
|
||||
* Tidy up now that the connection has gone away.
|
||||
*/
|
||||
[NSNotificationCenter removeObserver: self
|
||||
name: NSConnectionDidDieNotification
|
||||
object: connection];
|
||||
[[NSNotificationCenter defaultCenter]
|
||||
removeObserver: self
|
||||
name: NSConnectionDidDieNotification
|
||||
object: connection];
|
||||
NSAssert(connection == [remote connectionForProxy],
|
||||
NSInternalInconsistencyException);
|
||||
[remote release];
|
||||
|
|
|
@ -88,8 +88,9 @@ NSString *NSPortTimeoutException
|
|||
{
|
||||
[[NSPortNameServer defaultPortNameServer] removePort: self];
|
||||
is_valid = NO;
|
||||
[NSNotificationCenter postNotificationName: NSPortDidBecomeInvalidNotification
|
||||
object: self];
|
||||
[[NSNotificationCenter defaultCenter]
|
||||
postNotificationName: NSPortDidBecomeInvalidNotification
|
||||
object: self];
|
||||
}
|
||||
|
||||
- (BOOL) isValid
|
||||
|
|
|
@ -687,15 +687,17 @@ static NSPortNameServer *defaultServer = nil;
|
|||
{
|
||||
if (handle)
|
||||
{
|
||||
[NSNotificationCenter removeObserver: self
|
||||
name: GSFileHandleConnectCompletionNotification
|
||||
object: handle];
|
||||
[NSNotificationCenter removeObserver: self
|
||||
name: NSFileHandleReadCompletionNotification
|
||||
object: handle];
|
||||
[NSNotificationCenter removeObserver: self
|
||||
name: GSFileHandleWriteCompletionNotification
|
||||
object: handle];
|
||||
NSNotificationCenter *nc = [NSNotificationCenter defaultCenter];
|
||||
|
||||
[nc removeObserver: self
|
||||
name: GSFileHandleConnectCompletionNotification
|
||||
object: handle];
|
||||
[nc removeObserver: self
|
||||
name: NSFileHandleReadCompletionNotification
|
||||
object: handle];
|
||||
[nc removeObserver: self
|
||||
name: GSFileHandleWriteCompletionNotification
|
||||
object: handle];
|
||||
[handle closeFile];
|
||||
[handle release];
|
||||
handle = nil;
|
||||
|
@ -721,9 +723,10 @@ static NSPortNameServer *defaultServer = nil;
|
|||
* stop watching for connection completion.
|
||||
*/
|
||||
expecting = 0;
|
||||
[NSNotificationCenter removeObserver: self
|
||||
name: GSFileHandleConnectCompletionNotification
|
||||
object: handle];
|
||||
[[NSNotificationCenter defaultCenter]
|
||||
removeObserver: self
|
||||
name: GSFileHandleConnectCompletionNotification
|
||||
object: handle];
|
||||
}
|
||||
}
|
||||
|
||||
|
|
38
Tools/gdnc.m
38
Tools/gdnc.m
|
@ -174,15 +174,16 @@
|
|||
|
||||
- (void) dealloc
|
||||
{
|
||||
NSNotificationCenter *nc = [NSNotificationCenter defaultCenter];
|
||||
NSMapEnumerator enumerator;
|
||||
NSConnection *connection;
|
||||
NSMapTable *clients;
|
||||
|
||||
if (conn)
|
||||
{
|
||||
[NSNotificationCenter removeObserver: self
|
||||
name: NSConnectionDidDieNotification
|
||||
object: conn];
|
||||
[nc removeObserver: self
|
||||
name: NSConnectionDidDieNotification
|
||||
object: conn];
|
||||
[conn release];
|
||||
conn = nil;
|
||||
}
|
||||
|
@ -195,9 +196,9 @@
|
|||
while (NSNextMapEnumeratorPair(&enumerator,
|
||||
(void**)&connection, (void**)&clients) == YES)
|
||||
{
|
||||
[NSNotificationCenter removeObserver: self
|
||||
name: NSConnectionDidDieNotification
|
||||
object: connection];
|
||||
[nc removeObserver: self
|
||||
name: NSConnectionDidDieNotification
|
||||
object: connection];
|
||||
[self removeObserversForClients: clients];
|
||||
NSFreeMapTable(clients);
|
||||
}
|
||||
|
@ -236,10 +237,11 @@
|
|||
* Get notifications for new connections and connection losses.
|
||||
*/
|
||||
[conn setDelegate: self];
|
||||
[NSNotificationCenter addObserver: self
|
||||
selector: @selector(connectionBecameInvalid:)
|
||||
name: NSConnectionDidDieNotification
|
||||
object: conn];
|
||||
[[NSNotificationCenter defaultCenter]
|
||||
addObserver: self
|
||||
selector: @selector(connectionBecameInvalid:)
|
||||
name: NSConnectionDidDieNotification
|
||||
object: conn];
|
||||
return self;
|
||||
}
|
||||
|
||||
|
@ -341,10 +343,11 @@
|
|||
{
|
||||
NSMapTable *table;
|
||||
|
||||
[NSNotificationCenter addObserver: self
|
||||
selector: @selector(connectionBecameInvalid:)
|
||||
name: NSConnectionDidDieNotification
|
||||
object: newConn];
|
||||
[[NSNotificationCenter defaultCenter]
|
||||
addObserver: self
|
||||
selector: @selector(connectionBecameInvalid:)
|
||||
name: NSConnectionDidDieNotification
|
||||
object: newConn];
|
||||
[newConn setDelegate: self];
|
||||
/*
|
||||
* Create a new map table entry for this connection with a value that
|
||||
|
@ -361,9 +364,10 @@
|
|||
{
|
||||
id connection = [notification object];
|
||||
|
||||
[NSNotificationCenter removeObserver: self
|
||||
name: NSConnectionDidDieNotification
|
||||
object: connection];
|
||||
[[NSNotificationCenter defaultCenter]
|
||||
removeObserver: self
|
||||
name: NSConnectionDidDieNotification
|
||||
object: connection];
|
||||
|
||||
if (connection == conn)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue