mirror of
https://github.com/gnustep/libs-base.git
synced 2025-04-23 09:04:13 +00:00
Fix by Campbell
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@39343 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
b40715fd43
commit
d64aefec5d
2 changed files with 33 additions and 3 deletions
|
@ -1,3 +1,7 @@
|
|||
2016-02-09 Larry Campbell <lcampbel@akamai.com>
|
||||
|
||||
* Source/NSUserDefaults.m: Fix for bug #46956
|
||||
|
||||
2016-02-09 Richard Frith-Macdonald <rfm@gnu.org>
|
||||
|
||||
* Tools/gdomap.c: Use uint32_t rather than unsigned long ... we are
|
||||
|
|
|
@ -804,6 +804,21 @@ newLanguages(NSArray *oldNames)
|
|||
|
||||
if (nil == defs)
|
||||
{
|
||||
const unsigned retryCount = 100;
|
||||
const NSTimeInterval retryInterval = 0.1;
|
||||
unsigned i;
|
||||
for (i = 0; i < retryCount; i++)
|
||||
{
|
||||
[NSThread sleepForTimeInterval:retryInterval];
|
||||
[classLock lock];
|
||||
defs = [sharedDefaults retain];
|
||||
setup = hasSharedDefaults;
|
||||
[classLock unlock];
|
||||
if (YES == setup)
|
||||
{
|
||||
NS_VALRETURN([defs autorelease]);
|
||||
}
|
||||
}
|
||||
NSLog(@"WARNING - unable to create shared user defaults!\n");
|
||||
NS_VALRETURN(nil);
|
||||
}
|
||||
|
@ -1101,6 +1116,7 @@ newLanguages(NSArray *oldNames)
|
|||
NSFileManager *mgr = [NSFileManager defaultManager];
|
||||
NSRange r;
|
||||
BOOL flag;
|
||||
NSDictionary *argumentsDictionary = nil;
|
||||
|
||||
self = [super init];
|
||||
|
||||
|
@ -1158,8 +1174,12 @@ newLanguages(NSArray *oldNames)
|
|||
|
||||
// Create volatile defaults and add the Argument and the Registration domains
|
||||
_tempDomains = [[NSMutableDictionaryClass alloc] initWithCapacity: 10];
|
||||
[_tempDomains setObject: [self _createArgumentDictionary]
|
||||
argumentsDictionary = [self _createArgumentDictionary];
|
||||
if (nil != argumentsDictionary)
|
||||
{
|
||||
[_tempDomains setObject: argumentsDictionary
|
||||
forKey: NSArgumentDomain];
|
||||
}
|
||||
[_tempDomains
|
||||
setObject: [NSMutableDictionaryClass dictionaryWithCapacity: 10]
|
||||
forKey: NSRegistrationDomain];
|
||||
|
@ -2164,13 +2184,15 @@ NSDictionary *GSPrivateDefaultLocale()
|
|||
BOOL done;
|
||||
id key, val;
|
||||
|
||||
[_lock lock];
|
||||
[classLock lock];
|
||||
if (YES == parsingArguments)
|
||||
{
|
||||
[_lock unlock];
|
||||
[classLock unlock];
|
||||
return nil; // Prevent recursion
|
||||
}
|
||||
parsingArguments = YES;
|
||||
[classLock unlock];
|
||||
[_lock lock];
|
||||
NS_DURING
|
||||
{
|
||||
args = [[NSProcessInfo processInfo] arguments];
|
||||
|
@ -2253,12 +2275,16 @@ NSDictionary *GSPrivateDefaultLocale()
|
|||
}
|
||||
done = ((key = [enumerator nextObject]) == nil);
|
||||
}
|
||||
[classLock lock];
|
||||
parsingArguments = NO;
|
||||
[classLock unlock];
|
||||
[_lock unlock];
|
||||
}
|
||||
NS_HANDLER
|
||||
{
|
||||
[classLock lock];
|
||||
parsingArguments = NO;
|
||||
[classLock unlock];
|
||||
[_lock unlock];
|
||||
[localException raise];
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue