mirror of
https://github.com/gnustep/libs-base.git
synced 2025-04-22 16:33:29 +00:00
* Source/NSUserDefaults.m: Remove one of the locks in +userLanguages
to avoid a deadlock. Patch applied by: Gregory Casamento <greg.casamento@gmail.com> git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@28504 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
f85c3f0696
commit
7ef7e59996
2 changed files with 17 additions and 0 deletions
|
@ -2,6 +2,12 @@
|
|||
|
||||
* Source/NSConnection.m: Joined split-line string constant
|
||||
|
||||
2009-08-21 Doug Simons <dpsimons@testplant.com>
|
||||
|
||||
* Source/NSUserDefaults.m: Remove one of the locks in +userLanguages
|
||||
to avoid a deadlock.
|
||||
Patch applied by: Gregory Casamento <greg.casamento@gmail.com>
|
||||
|
||||
2009-08-21 Doug Simons <dpsimons@testplant.com>
|
||||
|
||||
* Source/NSUserDefaults.m: Changes to bulletproof NSUserDefaults from
|
||||
|
|
|
@ -486,6 +486,17 @@ static BOOL setSharedDefaults = NO; /* Flag to prevent infinite recursion */
|
|||
* +userLanguages uses this to rebuild language information and return it.
|
||||
*/
|
||||
|
||||
/* Return the sharedDefaults without locking in the simple case.
|
||||
* We need to lock and check again before CREATING sharedDefaults if it doesn't exist,
|
||||
* so that two threads can't create it at once (or call resetStandardUserDefaults at
|
||||
* the same time).
|
||||
* By not locking here, we avoid a deadlock that can occur between classLock and _lock. */
|
||||
if (setSharedDefaults == YES)
|
||||
{
|
||||
IF_NO_GC([sharedDefaults retain];)
|
||||
return AUTORELEASE(sharedDefaults);
|
||||
}
|
||||
|
||||
[classLock lock];
|
||||
|
||||
/*
|
||||
|
|
Loading…
Reference in a new issue