Bug 1475836: Clear cached callback pref when deleting branch. r?njn draft
authorKris Maglione <maglione.k@gmail.com>
Fri, 20 Jul 2018 11:57:37 -0700
changeset 821022 686becc0ecbc9173b857d650e3de07a111b8c63d
parent 821021 f09c12fc7f40945e4751818ef011fe800097e6e7
child 821033 ce26ca4168bb361dedf5346ec9fff2b5dae28760
push id116993
push usermaglione.k@gmail.com
push dateFri, 20 Jul 2018 18:58:06 +0000
reviewersnjn
bugs1475836
milestone63.0a1
Bug 1475836: Clear cached callback pref when deleting branch. r?njn MozReview-Commit-ID: C60kGkoFBL8
modules/libpref/Preferences.cpp
--- 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