mirror of
https://github.com/gnustep/libs-base.git
synced 2025-05-31 16:50:58 +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
a9c28e8013
commit
eda1ff3d60
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>
|
Mon Jun 14 10:20:00 1999 Richard Frith-Macdonald <richard@brainstorm.co.uk>
|
||||||
|
|
||||||
* Source/NSConcreteValue.m: Update for MacOS-X and for GC
|
* 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.
|
* 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.
|
* 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];
|
NSAutoreleasePool *arp = [NSAutoreleasePool new];
|
||||||
|
|
||||||
[NSNotificationCenter postNotificationName: NSConnectionDidDieNotification
|
[[NSNotificationCenter defaultCenter]
|
||||||
object: self];
|
postNotificationName: NSConnectionDidDieNotification
|
||||||
|
object: self];
|
||||||
[arp release];
|
[arp release];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1056,7 +1057,7 @@ static int messages_received_count;
|
||||||
NSHashInsert(connection_table, (void*)newConn);
|
NSHashInsert(connection_table, (void*)newConn);
|
||||||
[connection_table_gate unlock];
|
[connection_table_gate unlock];
|
||||||
|
|
||||||
[NSNotificationCenter
|
[[NSNotificationCenter defaultCenter]
|
||||||
postNotificationName: NSConnectionDidInitializeNotification
|
postNotificationName: NSConnectionDidInitializeNotification
|
||||||
object: newConn];
|
object: newConn];
|
||||||
|
|
||||||
|
|
|
@ -325,11 +325,11 @@ static NSDistributedNotificationCenter *defCenter = nil;
|
||||||
/*
|
/*
|
||||||
* Ask to be told if the copnnection goes away.
|
* Ask to be told if the copnnection goes away.
|
||||||
*/
|
*/
|
||||||
[NSNotificationCenter
|
[[NSNotificationCenter defaultCenter]
|
||||||
addObserver: self
|
addObserver: self
|
||||||
selector: @selector(_invalidated:)
|
selector: @selector(_invalidated:)
|
||||||
name: NSConnectionDidDieNotification
|
name: NSConnectionDidDieNotification
|
||||||
object: c];
|
object: c];
|
||||||
[remote registerClient: (id<GDNCClient>)self];
|
[remote registerClient: (id<GDNCClient>)self];
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -376,9 +376,10 @@ NSLog(@"Connection to GDNC server established.\n");
|
||||||
/*
|
/*
|
||||||
* Tidy up now that the connection has gone away.
|
* Tidy up now that the connection has gone away.
|
||||||
*/
|
*/
|
||||||
[NSNotificationCenter removeObserver: self
|
[[NSNotificationCenter defaultCenter]
|
||||||
name: NSConnectionDidDieNotification
|
removeObserver: self
|
||||||
object: connection];
|
name: NSConnectionDidDieNotification
|
||||||
|
object: connection];
|
||||||
NSAssert(connection == [remote connectionForProxy],
|
NSAssert(connection == [remote connectionForProxy],
|
||||||
NSInternalInconsistencyException);
|
NSInternalInconsistencyException);
|
||||||
[remote release];
|
[remote release];
|
||||||
|
|
|
@ -88,8 +88,9 @@ NSString *NSPortTimeoutException
|
||||||
{
|
{
|
||||||
[[NSPortNameServer defaultPortNameServer] removePort: self];
|
[[NSPortNameServer defaultPortNameServer] removePort: self];
|
||||||
is_valid = NO;
|
is_valid = NO;
|
||||||
[NSNotificationCenter postNotificationName: NSPortDidBecomeInvalidNotification
|
[[NSNotificationCenter defaultCenter]
|
||||||
object: self];
|
postNotificationName: NSPortDidBecomeInvalidNotification
|
||||||
|
object: self];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (BOOL) isValid
|
- (BOOL) isValid
|
||||||
|
|
|
@ -687,15 +687,17 @@ static NSPortNameServer *defaultServer = nil;
|
||||||
{
|
{
|
||||||
if (handle)
|
if (handle)
|
||||||
{
|
{
|
||||||
[NSNotificationCenter removeObserver: self
|
NSNotificationCenter *nc = [NSNotificationCenter defaultCenter];
|
||||||
name: GSFileHandleConnectCompletionNotification
|
|
||||||
object: handle];
|
[nc removeObserver: self
|
||||||
[NSNotificationCenter removeObserver: self
|
name: GSFileHandleConnectCompletionNotification
|
||||||
name: NSFileHandleReadCompletionNotification
|
object: handle];
|
||||||
object: handle];
|
[nc removeObserver: self
|
||||||
[NSNotificationCenter removeObserver: self
|
name: NSFileHandleReadCompletionNotification
|
||||||
name: GSFileHandleWriteCompletionNotification
|
object: handle];
|
||||||
object: handle];
|
[nc removeObserver: self
|
||||||
|
name: GSFileHandleWriteCompletionNotification
|
||||||
|
object: handle];
|
||||||
[handle closeFile];
|
[handle closeFile];
|
||||||
[handle release];
|
[handle release];
|
||||||
handle = nil;
|
handle = nil;
|
||||||
|
@ -721,9 +723,10 @@ static NSPortNameServer *defaultServer = nil;
|
||||||
* stop watching for connection completion.
|
* stop watching for connection completion.
|
||||||
*/
|
*/
|
||||||
expecting = 0;
|
expecting = 0;
|
||||||
[NSNotificationCenter removeObserver: self
|
[[NSNotificationCenter defaultCenter]
|
||||||
name: GSFileHandleConnectCompletionNotification
|
removeObserver: self
|
||||||
object: handle];
|
name: GSFileHandleConnectCompletionNotification
|
||||||
|
object: handle];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
38
Tools/gdnc.m
38
Tools/gdnc.m
|
@ -174,15 +174,16 @@
|
||||||
|
|
||||||
- (void) dealloc
|
- (void) dealloc
|
||||||
{
|
{
|
||||||
|
NSNotificationCenter *nc = [NSNotificationCenter defaultCenter];
|
||||||
NSMapEnumerator enumerator;
|
NSMapEnumerator enumerator;
|
||||||
NSConnection *connection;
|
NSConnection *connection;
|
||||||
NSMapTable *clients;
|
NSMapTable *clients;
|
||||||
|
|
||||||
if (conn)
|
if (conn)
|
||||||
{
|
{
|
||||||
[NSNotificationCenter removeObserver: self
|
[nc removeObserver: self
|
||||||
name: NSConnectionDidDieNotification
|
name: NSConnectionDidDieNotification
|
||||||
object: conn];
|
object: conn];
|
||||||
[conn release];
|
[conn release];
|
||||||
conn = nil;
|
conn = nil;
|
||||||
}
|
}
|
||||||
|
@ -195,9 +196,9 @@
|
||||||
while (NSNextMapEnumeratorPair(&enumerator,
|
while (NSNextMapEnumeratorPair(&enumerator,
|
||||||
(void**)&connection, (void**)&clients) == YES)
|
(void**)&connection, (void**)&clients) == YES)
|
||||||
{
|
{
|
||||||
[NSNotificationCenter removeObserver: self
|
[nc removeObserver: self
|
||||||
name: NSConnectionDidDieNotification
|
name: NSConnectionDidDieNotification
|
||||||
object: connection];
|
object: connection];
|
||||||
[self removeObserversForClients: clients];
|
[self removeObserversForClients: clients];
|
||||||
NSFreeMapTable(clients);
|
NSFreeMapTable(clients);
|
||||||
}
|
}
|
||||||
|
@ -236,10 +237,11 @@
|
||||||
* Get notifications for new connections and connection losses.
|
* Get notifications for new connections and connection losses.
|
||||||
*/
|
*/
|
||||||
[conn setDelegate: self];
|
[conn setDelegate: self];
|
||||||
[NSNotificationCenter addObserver: self
|
[[NSNotificationCenter defaultCenter]
|
||||||
selector: @selector(connectionBecameInvalid:)
|
addObserver: self
|
||||||
name: NSConnectionDidDieNotification
|
selector: @selector(connectionBecameInvalid:)
|
||||||
object: conn];
|
name: NSConnectionDidDieNotification
|
||||||
|
object: conn];
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -341,10 +343,11 @@
|
||||||
{
|
{
|
||||||
NSMapTable *table;
|
NSMapTable *table;
|
||||||
|
|
||||||
[NSNotificationCenter addObserver: self
|
[[NSNotificationCenter defaultCenter]
|
||||||
selector: @selector(connectionBecameInvalid:)
|
addObserver: self
|
||||||
name: NSConnectionDidDieNotification
|
selector: @selector(connectionBecameInvalid:)
|
||||||
object: newConn];
|
name: NSConnectionDidDieNotification
|
||||||
|
object: newConn];
|
||||||
[newConn setDelegate: self];
|
[newConn setDelegate: self];
|
||||||
/*
|
/*
|
||||||
* Create a new map table entry for this connection with a value that
|
* Create a new map table entry for this connection with a value that
|
||||||
|
@ -361,9 +364,10 @@
|
||||||
{
|
{
|
||||||
id connection = [notification object];
|
id connection = [notification object];
|
||||||
|
|
||||||
[NSNotificationCenter removeObserver: self
|
[[NSNotificationCenter defaultCenter]
|
||||||
name: NSConnectionDidDieNotification
|
removeObserver: self
|
||||||
object: connection];
|
name: NSConnectionDidDieNotification
|
||||||
|
object: connection];
|
||||||
|
|
||||||
if (connection == conn)
|
if (connection == conn)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue