diff --git a/ChangeLog b/ChangeLog index fe47d103e..50d5912d3 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2006-09-06 Richard Frith-Macdonald + + * 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 * Version 1.13.0 diff --git a/Source/NSConnection.m b/Source/NSConnection.m index 12161781a..d2ee860cb 100644 --- a/Source/NSConnection.m +++ b/Source/NSConnection.m @@ -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]; }