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
This commit is contained in:
Wolfgang Lux 2009-10-20 05:25:04 +00:00
parent 9d215e7e76
commit acb28bb1c2
2 changed files with 7 additions and 2 deletions

View file

@ -1,3 +1,8 @@
2009-10-20 Wolfgang Lux <wolfgang.lux@gmail.com>
* Source/NSObject.m (NSIncrementExtraRefCount): Properly release
allocation lock.
2009-10-12 Richard Frith-Macdonald <rfm@gnu.org>
* Source/NSProcessInfo.m:

View file

@ -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