Make port removal more robust.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@11392 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Richard Frith-Macdonald 2001-11-13 10:37:16 +00:00
parent 06bc0f9590
commit 2f04810b22
2 changed files with 19 additions and 18 deletions

View file

@ -6,6 +6,8 @@
* Source/NSUserDefaults.m: Changed the method name +resetUserDefaults
to be +resetStandardUserDefaults for compatibility with MacOS-X, which
has now implemented an equivalent for the GNUstep method.
* Source/NSPortNameServer.m: When removing a port, remove from
internal name tables even if gdomap reports no name to unregister.
2001-11-12 Richard Frith-Macdonald <rfm@gnu.org>

View file

@ -992,6 +992,7 @@ typedef enum {
}
else
{
NSPort *port;
unsigned result;
result = GSSwapBigI32ToHost(*(gsu32*)[[com data] bytes]);
@ -1002,29 +1003,27 @@ typedef enum {
}
else
{
NSPort *port;
val = YES;
}
/*
* Find the port that was registered for this name and
* remove the mapping table entries.
*/
port = NSMapGet(_nameMap, name);
if (port)
{
NSMutableSet *known;
/*
* Find the port that was registered for this name and
* remove the mapping table entries.
*/
port = NSMapGet(_nameMap, name);
if (port)
NSMapRemove(_nameMap, name);
known = NSMapGet(_portMap, port);
if (known)
{
NSMutableSet *known;
NSMapRemove(_nameMap, name);
known = NSMapGet(_portMap, port);
if (known)
[known removeObject: name];
if ([known count] == 0)
{
[known removeObject: name];
if ([known count] == 0)
{
NSMapRemove(_portMap, port);
}
NSMapRemove(_portMap, port);
}
}
val = YES;
}
}
tmp = com;