git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@27645 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
rfm 2009-01-21 06:39:39 +00:00
parent d87f6278c5
commit 0ead926e50
3 changed files with 11 additions and 3 deletions

View file

@ -1,3 +1,8 @@
2009-01-21 Richard Frith-Macdonald <rfm@gnu.org>
* Source/NSUserDefaults.m: ([setObject:forKey:]) copy the object
rather than just retaining it. Fixes bug #23570
2009-01-20 Richard Frith-Macdonald <rfm@gnu.org> 2009-01-20 Richard Frith-Macdonald <rfm@gnu.org>
* Documentation/manual/ExceptionHandling.texi: Fix error in * Documentation/manual/ExceptionHandling.texi: Fix error in

View file

@ -384,10 +384,11 @@ GS_EXPORT NSString* const GSLocale;
- (void) setInteger: (int)value forKey: (NSString*)defaultName; - (void) setInteger: (int)value forKey: (NSString*)defaultName;
/** /**
* Sets an object value for defaultName in the application domain.<br /> * Sets a copy of an object value for defaultName in the
* application domain.<br />
* The defaultName must be a non-empty string.<br /> * The defaultName must be a non-empty string.<br />
* The value must be an instance of one of the [NSString-propertyList] * The value to be copied into the domain must be an instance
* classes.<br /> * of one of the [NSString-propertyList] classes.<br />
* <p>Causes a NSUserDefaultsDidChangeNotification to be posted * <p>Causes a NSUserDefaultsDidChangeNotification to be posted
* if this is the first change to a persistent-domain since the * if this is the first change to a persistent-domain since the
* last -synchronize. * last -synchronize.

View file

@ -1158,6 +1158,7 @@ static BOOL isPlistObject(id o)
value, defaultName]; value, defaultName];
} }
value = [value copy];
[_lock lock]; [_lock lock];
obj = [_persDomains objectForKey: processName]; obj = [_persDomains objectForKey: processName];
if ([obj isKindOfClass: NSMutableDictionaryClass] == YES) if ([obj isKindOfClass: NSMutableDictionaryClass] == YES)
@ -1173,6 +1174,7 @@ static BOOL isPlistObject(id o)
[dict setObject: value forKey: defaultName]; [dict setObject: value forKey: defaultName];
[self __changePersistentDomain: processName]; [self __changePersistentDomain: processName];
[_lock unlock]; [_lock unlock];
RELEASE(value);
} }
- (void) setValue: (id)value forKey: (NSString*)defaultName - (void) setValue: (id)value forKey: (NSString*)defaultName