Avoid use of NSDeallocateObject() as it dooesn't work properly with new runtime.

This commit is contained in:
rfm 2025-01-02 17:43:28 +00:00
parent ae8367e401
commit bc3d2508ee
4 changed files with 13 additions and 34 deletions

View file

@ -1467,16 +1467,12 @@ static NSLock *cached_proxies_gate = nil;
* and try to use it while it is being deallocated. * and try to use it while it is being deallocated.
*/ */
GS_M_LOCK(connection_table_gate); GS_M_LOCK(connection_table_gate);
if (NSDecrementExtraRefCountWasZero(self)) if (1 == [self retainCount])
{ {
NSHashRemove(connection_table, self); NSHashRemove(connection_table, self);
GSM_UNLOCK(connection_table_gate);
[self dealloc];
}
else
{
GSM_UNLOCK(connection_table_gate);
} }
GSM_UNLOCK(connection_table_gate);
[super release];
} }
/** /**

View file

@ -1699,20 +1699,12 @@ typedef struct {
- (oneway void) release - (oneway void) release
{ {
M_LOCK(messagePortLock); M_LOCK(messagePortLock);
if (NSDecrementExtraRefCountWasZero(self)) if (_internal != 0 && 1 == [self retainCount])
{ {
if (_internal != 0) NSMapRemove(messagePortMap, (void*)name);
{
NSMapRemove(messagePortMap, (void*)name);
}
[self retain];
M_UNLOCK(messagePortLock);
[super release];
}
else
{
M_UNLOCK(messagePortLock);
} }
M_UNLOCK(messagePortLock);
[super release];
} }
- (void) removeHandle: (GSMessageHandle*)handle - (void) removeHandle: (GSMessageHandle*)handle

View file

@ -2465,7 +2465,7 @@ static Class tcpPortClass;
- (oneway void) release - (oneway void) release
{ {
M_LOCK(tcpPortLock); M_LOCK(tcpPortLock);
if (NSDecrementExtraRefCountWasZero(self)) if (1 == [self retainCount])
{ {
NSMapTable *thePorts; NSMapTable *thePorts;
@ -2474,14 +2474,9 @@ static Class tcpPortClass;
{ {
NSMapRemove(thePorts, host); NSMapRemove(thePorts, host);
} }
[self retain];
M_UNLOCK(tcpPortLock);
[super release];
}
else
{
M_UNLOCK(tcpPortLock);
} }
M_UNLOCK(tcpPortLock);
[super release];
} }

View file

@ -949,16 +949,12 @@ again:
* and try to use it while it is being deallocated. * and try to use it while it is being deallocated.
*/ */
M_LOCK(messagePortLock); M_LOCK(messagePortLock);
if (NSDecrementExtraRefCountWasZero(self)) if (1 == [self retainCount])
{ {
NSMapRemove(ports, (void*)[self name]); NSMapRemove(ports, (void*)[self name]);
M_UNLOCK(messagePortLock);
[self dealloc];
}
else
{
M_UNLOCK(messagePortLock);
} }
M_UNLOCK(messagePortLock);
[super release];
} }
- (BOOL) sendBeforeDate: (NSDate*)when - (BOOL) sendBeforeDate: (NSDate*)when