From 56ba86ce4c623204adec399624a3dc0dc93fae2c Mon Sep 17 00:00:00 2001 From: wlux Date: Tue, 20 Oct 2009 05:25:04 +0000 Subject: [PATCH] Prevent potential deadlock in multithreaded programs due to an allocation lock that was never unlocked. git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@28859 72102866-910b-0410-8b05-ffd578937521 --- ChangeLog | 5 +++++ Source/NSObject.m | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 98888f07c..8db972952 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2009-10-20 Wolfgang Lux + + * Source/NSObject.m (NSIncrementExtraRefCount): Properly release + allocation lock. + 2009-10-12 Richard Frith-Macdonald * Source/NSProcessInfo.m: diff --git a/Source/NSObject.m b/Source/NSObject.m index dd0a9c824..6573b648a 100644 --- a/Source/NSObject.m +++ b/Source/NSObject.m @@ -496,12 +496,12 @@ NSIncrementExtraRefCount(id anObject) [theLock lock]; if (((obj)anObject)[-1].retained == UINT_MAX - 1) { - objc_mutex_unlock (theLock); + [theLock unlock]; [NSException raise: NSInternalInconsistencyException format: @"NSIncrementExtraRefCount() asked to increment too far"]; } ((obj)anObject)[-1].retained++; - [theLock lock]; + [theLock unlock]; #endif /* GSATOMICREAD */ } else