mirror of
https://github.com/gnustep/libs-base.git
synced 2025-04-22 16:33:29 +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
082dc66e43
commit
265a8224d3
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>
|
||||
|
||||
* Source/NSMessagePort.m (-invalidate, -removeHandle:): Fix
|
||||
|
|
|
@ -1369,11 +1369,6 @@ typedef struct {
|
|||
- (void) dealloc
|
||||
{
|
||||
[self gcFinalize];
|
||||
if (_internal != 0)
|
||||
{
|
||||
DESTROY(name);
|
||||
NSZoneFree(NSDefaultMallocZone(), _internal);
|
||||
}
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
|
@ -1390,6 +1385,13 @@ typedef struct {
|
|||
{
|
||||
NSDebugMLLog(@"NSMessagePort", @"NSMessagePort 0x%x finalized", self);
|
||||
[self invalidate];
|
||||
if (_internal != 0)
|
||||
{
|
||||
DESTROY(name);
|
||||
NSFreeMapTable(handles);
|
||||
RELEASE(myLock);
|
||||
NSZoneFree(NSDefaultMallocZone(), _internal);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -1571,11 +1573,8 @@ typedef struct {
|
|||
{
|
||||
if ([self isValid] == YES)
|
||||
{
|
||||
/* 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);
|
||||
RETAIN(self);
|
||||
M_LOCK(myLock);
|
||||
|
||||
if ([self isValid] == YES)
|
||||
{
|
||||
|
@ -1592,31 +1591,21 @@ typedef struct {
|
|||
lDesc = -1;
|
||||
}
|
||||
|
||||
if (handles != 0)
|
||||
handleArray = NSAllMapTableValues(handles);
|
||||
i = [handleArray count];
|
||||
while (i-- > 0)
|
||||
{
|
||||
handleArray = NSAllMapTableValues(handles);
|
||||
i = [handleArray count];
|
||||
while (i-- > 0)
|
||||
{
|
||||
GSMessageHandle *handle;
|
||||
GSMessageHandle *handle;
|
||||
|
||||
handle = [handleArray objectAtIndex: i];
|
||||
[handle invalidate];
|
||||
}
|
||||
/*
|
||||
* We permit mutual recursive invalidation, so the handles map
|
||||
* may already have been destroyed.
|
||||
*/
|
||||
if (handles != 0)
|
||||
{
|
||||
NSFreeMapTable(handles);
|
||||
handles = 0;
|
||||
}
|
||||
handle = [handleArray objectAtIndex: i];
|
||||
[handle invalidate];
|
||||
}
|
||||
|
||||
[[NSMessagePortNameServer sharedInstance] removePort: self];
|
||||
[super invalidate];
|
||||
}
|
||||
M_UNLOCK(lock);
|
||||
M_UNLOCK(myLock);
|
||||
RELEASE(self);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1626,7 +1615,7 @@ typedef struct {
|
|||
{
|
||||
return YES;
|
||||
}
|
||||
if ([anObject class] == [self class])
|
||||
if ([anObject class] == [self class] && [self isValid] && [anObject isValid])
|
||||
{
|
||||
NSMessagePort *o = (NSMessagePort*)anObject;
|
||||
|
||||
|
@ -1720,11 +1709,8 @@ typedef struct {
|
|||
|
||||
- (void) removeHandle: (GSMessageHandle*)handle
|
||||
{
|
||||
/* 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);
|
||||
RETAIN(self);
|
||||
M_LOCK(myLock);
|
||||
if ([handle sendPort] == self)
|
||||
{
|
||||
if (handle->caller != YES)
|
||||
|
@ -1749,7 +1735,8 @@ typedef struct {
|
|||
{
|
||||
[self invalidate];
|
||||
}
|
||||
M_UNLOCK(lock);
|
||||
M_UNLOCK(myLock);
|
||||
RELEASE(self);
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -1287,10 +1287,6 @@ static void determineOperatingSystem()
|
|||
{
|
||||
return val;
|
||||
}
|
||||
else if (sysctlbyname("activecpu", &val, &len, 0, 0) == 0)
|
||||
{
|
||||
return val;
|
||||
}
|
||||
return [self processorCount];
|
||||
#else
|
||||
return [self processorCount];
|
||||
|
|
|
@ -1824,6 +1824,11 @@ static Class tcpPortClass;
|
|||
{
|
||||
NSDebugMLLog(@"NSPort", @"NSSocketPort 0x%x finalized", self);
|
||||
[self invalidate];
|
||||
if (handles != 0)
|
||||
{
|
||||
NSFreeMapTable(handles);
|
||||
handles = 0;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -2053,6 +2058,7 @@ static Class tcpPortClass;
|
|||
{
|
||||
if ([self isValid] == YES)
|
||||
{
|
||||
RETAIN(self);
|
||||
M_LOCK(myLock);
|
||||
|
||||
if ([self isValid] == YES)
|
||||
|
@ -2089,15 +2095,6 @@ static Class tcpPortClass;
|
|||
|
||||
[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 (events != 0)
|
||||
|
@ -2110,6 +2107,7 @@ static Class tcpPortClass;
|
|||
[super invalidate];
|
||||
}
|
||||
M_UNLOCK(myLock);
|
||||
RELEASE(self);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2254,6 +2252,7 @@ static Class tcpPortClass;
|
|||
*/
|
||||
- (void) removeHandle: (GSTcpHandle*)handle
|
||||
{
|
||||
RETAIN(self);
|
||||
M_LOCK(myLock);
|
||||
if ([handle sendPort] == self)
|
||||
{
|
||||
|
@ -2283,6 +2282,7 @@ static Class tcpPortClass;
|
|||
[self invalidate];
|
||||
}
|
||||
M_UNLOCK(myLock);
|
||||
RELEASE(self);
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
Loading…
Reference in a new issue