mirror of
https://github.com/gnustep/libs-base.git
synced 2025-04-23 00:41:02 +00:00
Thread safetly fix suggested by Wim
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@23402 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
94290955f2
commit
3a2f4b1a05
2 changed files with 13 additions and 0 deletions
|
@ -1,3 +1,9 @@
|
|||
2006-09-06 Richard Frith-Macdonald <rfm@gnu.org>
|
||||
|
||||
* Source/NSConnection.m: ([release]) protect with connection table
|
||||
lock to prevent an other thread grabbing the connection while we
|
||||
are deallocating it. Bug reported by Wim Oudshoorn.
|
||||
|
||||
2006-08-28 Adam Fedor <fedor@gnu.org>
|
||||
|
||||
* Version 1.13.0
|
||||
|
|
|
@ -1282,15 +1282,22 @@ static NSLock *cached_proxies_gate = nil;
|
|||
/*
|
||||
* If this would cause the connection to be deallocated then we
|
||||
* must perform all necessary work (done in [-gcFinalize]).
|
||||
*
|
||||
* We bracket the code with a retain and release so that any
|
||||
* retain/release pairs in the code won't cause recursion.
|
||||
*
|
||||
* We lock the connection table while checking, to prevent
|
||||
* another thread from grabbing this connection while we are
|
||||
* finalizing/deallocating it.
|
||||
*/
|
||||
M_LOCK(connection_table_gate);
|
||||
if ([self retainCount] == 1)
|
||||
{
|
||||
[super retain];
|
||||
[self gcFinalize];
|
||||
[super release];
|
||||
}
|
||||
M_UNLOCK(connection_table_gate);
|
||||
[super release];
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue