diff --git a/modules/libpref/Preferences.cpp b/modules/libpref/Preferences.cpp index 79943ac82b73..e031c89c2a92 100644 --- a/modules/libpref/Preferences.cpp +++ b/modules/libpref/Preferences.cpp @@ -2895,6 +2895,8 @@ nsPrefBranch::DeleteBranch(const char* aStartingAt) nsDependentCString name(pref->Name()); if (StringBeginsWith(name, branchName) || name.Equals(branchNameNoDot)) { iter.Remove(); + // The saved callback pref may be invalid now. + gCallbackPref = nullptr; } }