Bug 1475836: Clear cached callback pref when deleting branch. r?njn
MozReview-Commit-ID: C60kGkoFBL8
--- a/modules/libpref/Preferences.cpp
+++ b/modules/libpref/Preferences.cpp
@@ -2890,16 +2890,18 @@ nsPrefBranch::DeleteBranch(const char* a
// The first disjunct matches branches: e.g. a branch name "foo.bar."
// matches a name "foo.bar.baz" (but it won't match "foo.barrel.baz").
// The second disjunct matches leaf nodes: e.g. a branch name "foo.bar."
// matches a name "foo.bar" (by ignoring the trailing '.').
nsDependentCString name(pref->Name());
if (StringBeginsWith(name, branchName) || name.Equals(branchNameNoDot)) {
iter.Remove();
+ // The saved callback pref may be invalid now.
+ gCallbackPref = nullptr;
}
}
Preferences::HandleDirty();
return NS_OK;
}
NS_IMETHODIMP