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:
wlux 2009-10-20 05:25:04 +00:00
parent 8755ceb15b
commit 56ba86ce4c
2 changed files with 7 additions and 2 deletions

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