Skip to content

Commit

Permalink
NSUserDefaults: Fetch new value from all domains
Browse files Browse the repository at this point in the history
  • Loading branch information
hmelder committed Oct 24, 2024
1 parent ef9781f commit 4143b53
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion Source/NSUserDefaults.m
Original file line number Diff line number Diff line change
Expand Up @@ -1662,8 +1662,14 @@ - (void) setObject: (id)value forKey: (NSString*)defaultName
old = [self objectForKey: defaultName];
if ([pd setObject: value forKey: defaultName])
{
id new;

// New value must be fetched from all domains, as there might be
// a registered default if value is nil, or the value is
// superseded by GSPrimary or NSArgumentDomain
new = [self objectForKey: defaultName];
[self _changePersistentDomain: processName];
[self _notifyObserversOfChangeForKey: defaultName oldValue:old newValue:value];
[self _notifyObserversOfChangeForKey: defaultName oldValue:old newValue:new];
}
else
{
Expand Down

0 comments on commit 4143b53

Please sign in to comment.