mirror of
https://github.com/gnustep/libs-base.git
synced 2025-05-30 16:30:41 +00:00
Minor bugfixes
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@27062 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
7b196e7026
commit
efb60606ac
4 changed files with 40 additions and 49 deletions
|
@ -1,3 +1,11 @@
|
||||||
|
2008-10-15 Richard Frith-Macdonald <rfm@gnu.org>
|
||||||
|
|
||||||
|
* Source/NSProcessInfo.m: Remove useless sysctl command.
|
||||||
|
* Source/NSMessagePort.m: Ensure port is not deallocated while
|
||||||
|
being invalidated. Fix memory leak of port lock.
|
||||||
|
* Source/NSSocketPort.m: Ensure port is not deallocated while
|
||||||
|
being invalidated.
|
||||||
|
|
||||||
2008-11-15 Wolfgang Lux <wolfgang.lux@gmail.com>
|
2008-11-15 Wolfgang Lux <wolfgang.lux@gmail.com>
|
||||||
|
|
||||||
* Source/NSMessagePort.m (-invalidate, -removeHandle:): Fix
|
* Source/NSMessagePort.m (-invalidate, -removeHandle:): Fix
|
||||||
|
|
|
@ -1369,11 +1369,6 @@ typedef struct {
|
||||||
- (void) dealloc
|
- (void) dealloc
|
||||||
{
|
{
|
||||||
[self gcFinalize];
|
[self gcFinalize];
|
||||||
if (_internal != 0)
|
|
||||||
{
|
|
||||||
DESTROY(name);
|
|
||||||
NSZoneFree(NSDefaultMallocZone(), _internal);
|
|
||||||
}
|
|
||||||
[super dealloc];
|
[super dealloc];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1390,6 +1385,13 @@ typedef struct {
|
||||||
{
|
{
|
||||||
NSDebugMLLog(@"NSMessagePort", @"NSMessagePort 0x%x finalized", self);
|
NSDebugMLLog(@"NSMessagePort", @"NSMessagePort 0x%x finalized", self);
|
||||||
[self invalidate];
|
[self invalidate];
|
||||||
|
if (_internal != 0)
|
||||||
|
{
|
||||||
|
DESTROY(name);
|
||||||
|
NSFreeMapTable(handles);
|
||||||
|
RELEASE(myLock);
|
||||||
|
NSZoneFree(NSDefaultMallocZone(), _internal);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -1571,11 +1573,8 @@ typedef struct {
|
||||||
{
|
{
|
||||||
if ([self isValid] == YES)
|
if ([self isValid] == YES)
|
||||||
{
|
{
|
||||||
/* Copy the lock into a local variable since the _internal structure
|
RETAIN(self);
|
||||||
* may be freed during the call to [super invalidate]
|
M_LOCK(myLock);
|
||||||
*/
|
|
||||||
NSRecursiveLock *lock = ((internal*)_internal)->_myLock;
|
|
||||||
M_LOCK(lock);
|
|
||||||
|
|
||||||
if ([self isValid] == YES)
|
if ([self isValid] == YES)
|
||||||
{
|
{
|
||||||
|
@ -1592,31 +1591,21 @@ typedef struct {
|
||||||
lDesc = -1;
|
lDesc = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (handles != 0)
|
handleArray = NSAllMapTableValues(handles);
|
||||||
|
i = [handleArray count];
|
||||||
|
while (i-- > 0)
|
||||||
{
|
{
|
||||||
handleArray = NSAllMapTableValues(handles);
|
GSMessageHandle *handle;
|
||||||
i = [handleArray count];
|
|
||||||
while (i-- > 0)
|
|
||||||
{
|
|
||||||
GSMessageHandle *handle;
|
|
||||||
|
|
||||||
handle = [handleArray objectAtIndex: i];
|
handle = [handleArray objectAtIndex: i];
|
||||||
[handle invalidate];
|
[handle invalidate];
|
||||||
}
|
|
||||||
/*
|
|
||||||
* We permit mutual recursive invalidation, so the handles map
|
|
||||||
* may already have been destroyed.
|
|
||||||
*/
|
|
||||||
if (handles != 0)
|
|
||||||
{
|
|
||||||
NSFreeMapTable(handles);
|
|
||||||
handles = 0;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[[NSMessagePortNameServer sharedInstance] removePort: self];
|
[[NSMessagePortNameServer sharedInstance] removePort: self];
|
||||||
[super invalidate];
|
[super invalidate];
|
||||||
}
|
}
|
||||||
M_UNLOCK(lock);
|
M_UNLOCK(myLock);
|
||||||
|
RELEASE(self);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1626,7 +1615,7 @@ typedef struct {
|
||||||
{
|
{
|
||||||
return YES;
|
return YES;
|
||||||
}
|
}
|
||||||
if ([anObject class] == [self class])
|
if ([anObject class] == [self class] && [self isValid] && [anObject isValid])
|
||||||
{
|
{
|
||||||
NSMessagePort *o = (NSMessagePort*)anObject;
|
NSMessagePort *o = (NSMessagePort*)anObject;
|
||||||
|
|
||||||
|
@ -1720,11 +1709,8 @@ typedef struct {
|
||||||
|
|
||||||
- (void) removeHandle: (GSMessageHandle*)handle
|
- (void) removeHandle: (GSMessageHandle*)handle
|
||||||
{
|
{
|
||||||
/* Copy the lock into a local variable since the _internal structure
|
RETAIN(self);
|
||||||
* may be freed during the call to [self invalidate]
|
M_LOCK(myLock);
|
||||||
*/
|
|
||||||
NSRecursiveLock *lock = ((internal*)_internal)->_myLock;
|
|
||||||
M_LOCK(lock);
|
|
||||||
if ([handle sendPort] == self)
|
if ([handle sendPort] == self)
|
||||||
{
|
{
|
||||||
if (handle->caller != YES)
|
if (handle->caller != YES)
|
||||||
|
@ -1749,7 +1735,8 @@ typedef struct {
|
||||||
{
|
{
|
||||||
[self invalidate];
|
[self invalidate];
|
||||||
}
|
}
|
||||||
M_UNLOCK(lock);
|
M_UNLOCK(myLock);
|
||||||
|
RELEASE(self);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -1287,10 +1287,6 @@ static void determineOperatingSystem()
|
||||||
{
|
{
|
||||||
return val;
|
return val;
|
||||||
}
|
}
|
||||||
else if (sysctlbyname("activecpu", &val, &len, 0, 0) == 0)
|
|
||||||
{
|
|
||||||
return val;
|
|
||||||
}
|
|
||||||
return [self processorCount];
|
return [self processorCount];
|
||||||
#else
|
#else
|
||||||
return [self processorCount];
|
return [self processorCount];
|
||||||
|
|
|
@ -1824,6 +1824,11 @@ static Class tcpPortClass;
|
||||||
{
|
{
|
||||||
NSDebugMLLog(@"NSPort", @"NSSocketPort 0x%x finalized", self);
|
NSDebugMLLog(@"NSPort", @"NSSocketPort 0x%x finalized", self);
|
||||||
[self invalidate];
|
[self invalidate];
|
||||||
|
if (handles != 0)
|
||||||
|
{
|
||||||
|
NSFreeMapTable(handles);
|
||||||
|
handles = 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -2053,6 +2058,7 @@ static Class tcpPortClass;
|
||||||
{
|
{
|
||||||
if ([self isValid] == YES)
|
if ([self isValid] == YES)
|
||||||
{
|
{
|
||||||
|
RETAIN(self);
|
||||||
M_LOCK(myLock);
|
M_LOCK(myLock);
|
||||||
|
|
||||||
if ([self isValid] == YES)
|
if ([self isValid] == YES)
|
||||||
|
@ -2089,15 +2095,6 @@ static Class tcpPortClass;
|
||||||
|
|
||||||
[handle invalidate];
|
[handle invalidate];
|
||||||
}
|
}
|
||||||
/*
|
|
||||||
* We permit mutual recursive invalidation, so the handles map
|
|
||||||
* may already have been destroyed.
|
|
||||||
*/
|
|
||||||
if (handles != 0)
|
|
||||||
{
|
|
||||||
NSFreeMapTable(handles);
|
|
||||||
handles = 0;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
#if defined(__MINGW32__)
|
#if defined(__MINGW32__)
|
||||||
if (events != 0)
|
if (events != 0)
|
||||||
|
@ -2110,6 +2107,7 @@ static Class tcpPortClass;
|
||||||
[super invalidate];
|
[super invalidate];
|
||||||
}
|
}
|
||||||
M_UNLOCK(myLock);
|
M_UNLOCK(myLock);
|
||||||
|
RELEASE(self);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2254,6 +2252,7 @@ static Class tcpPortClass;
|
||||||
*/
|
*/
|
||||||
- (void) removeHandle: (GSTcpHandle*)handle
|
- (void) removeHandle: (GSTcpHandle*)handle
|
||||||
{
|
{
|
||||||
|
RETAIN(self);
|
||||||
M_LOCK(myLock);
|
M_LOCK(myLock);
|
||||||
if ([handle sendPort] == self)
|
if ([handle sendPort] == self)
|
||||||
{
|
{
|
||||||
|
@ -2283,6 +2282,7 @@ static Class tcpPortClass;
|
||||||
[self invalidate];
|
[self invalidate];
|
||||||
}
|
}
|
||||||
M_UNLOCK(myLock);
|
M_UNLOCK(myLock);
|
||||||
|
RELEASE(self);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue