Fix potential crash while closing a message port.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@27060 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Wolfgang Lux 2008-11-14 23:30:50 +00:00
parent d4117b5010
commit 082dc66e43
2 changed files with 17 additions and 4 deletions

View file

@ -1,3 +1,8 @@
2008-11-15 Wolfgang Lux <wolfgang.lux@gmail.com>
* Source/NSMessagePort.m (-invalidate, -removeHandle:): Fix
potential crash while closing a message port.
2008-11-14 Wolfgang Lux <wolfgang.lux@gmail.com>
* Source/NSProcessInfo.m (-processorCount, -activeProcessorCount):

View file

@ -1571,7 +1571,11 @@ typedef struct {
{
if ([self isValid] == YES)
{
M_LOCK(myLock);
/* Copy the lock into a local variable since the _internal structure
* may be freed during the call to [super invalidate]
*/
NSRecursiveLock *lock = ((internal*)_internal)->_myLock;
M_LOCK(lock);
if ([self isValid] == YES)
{
@ -1612,7 +1616,7 @@ typedef struct {
[[NSMessagePortNameServer sharedInstance] removePort: self];
[super invalidate];
}
M_UNLOCK(myLock);
M_UNLOCK(lock);
}
}
@ -1716,7 +1720,11 @@ typedef struct {
- (void) removeHandle: (GSMessageHandle*)handle
{
M_LOCK(myLock);
/* Copy the lock into a local variable since the _internal structure
* may be freed during the call to [self invalidate]
*/
NSRecursiveLock *lock = ((internal*)_internal)->_myLock;
M_LOCK(lock);
if ([handle sendPort] == self)
{
if (handle->caller != YES)
@ -1741,7 +1749,7 @@ typedef struct {
{
[self invalidate];
}
M_UNLOCK(myLock);
M_UNLOCK(lock);
}
/*