Post NSUserDefaultsDidChangeNotification when a lookup changes - #761
Merged
rfm merged 2 commits intoAug 15, 2026
Conversation
addSuiteNamed:, removeSuiteNamed:, setSearchList:, setVolatileDomain:forName:, removeVolatileDomainForName: and registerDefaults: alter what objectForKey: can see and posted nothing. The post uses the shape _changePersistentDomain: already has, a flag set under the lock and the post after unlocking. setSearchList: keeps its existing guard, so an equal list still posts nothing.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Nothing is posted when these methods alter what objectForKey: can see: registerDefaults:, setVolatileDomain:forName:, removeVolatileDomainForName:, addSuiteNamed:, removeSuiteNamed: and setSearchList:. Everything else that changes the mapping posts already, through _changePersistentDomain: or its own call.
Each now posts, in the shape _changePersistentDomain: already uses, a flag set under the lock and the post made after unlocking.
setSearchList: keeps its existing isEqual: guard, so an equal list still posts nothing. The rest post unconditionally, matching the note in setObject:forKey: about notifying even where the value has not changed. The registration domain that resetStandardUserDefaults reinstalls on the new shared instance is not covered here.
Tests/base/NSUserDefaults/notifications.m exercises all of them.
On master 6 of its 8 assertions fail, one for each method, and all 8 pass with the change. The suite passes 13488 with 44 dashed hopes and no failures. #756 discusses this.