diff --git a/modules/libpref/public/Preferences.h b/modules/libpref/public/Preferences.h index 37a57df3c02..751e8b23126 100644 --- a/modules/libpref/public/Preferences.h +++ b/modules/libpref/public/Preferences.h @@ -50,7 +50,6 @@ public: NS_DECL_NSIOBSERVER Preferences(); - virtual ~Preferences(); nsresult Init(); @@ -353,6 +352,8 @@ public: static nsresult SetFloat(const char* aPref, float aValue); protected: + virtual ~Preferences(); + nsresult NotifyServiceObservers(const char *aSubject); /** * Reads the default pref file or, if that failed, try to save a new one. diff --git a/modules/libpref/src/Preferences.cpp b/modules/libpref/src/Preferences.cpp index 9b48912c9ad..aa419e708d1 100644 --- a/modules/libpref/src/Preferences.cpp +++ b/modules/libpref/src/Preferences.cpp @@ -128,6 +128,10 @@ public: class ValueObserver MOZ_FINAL : public nsIObserver, public ValueObserverHashKey { + ~ValueObserver() { + Preferences::RemoveObserver(this, mPrefName.get()); + } + public: NS_DECL_ISUPPORTS NS_DECL_NSIOBSERVER @@ -135,10 +139,6 @@ public: ValueObserver(const char *aPref, PrefChangedFunc aCallback) : ValueObserverHashKey(aPref, aCallback) { } - ~ValueObserver() { - Preferences::RemoveObserver(this, mPrefName.get()); - } - void AppendClosure(void *aClosure) { mClosures.AppendElement(aClosure); } @@ -229,6 +229,8 @@ Preferences::SizeOfIncludingThisAndOtherStuff(mozilla::MallocSizeOf aMallocSizeO class PreferenceServiceReporter MOZ_FINAL : public nsIMemoryReporter { + ~PreferenceServiceReporter() {} + public: NS_DECL_ISUPPORTS NS_DECL_NSIMEMORYREPORTER diff --git a/modules/libpref/src/nsPrefBranch.h b/modules/libpref/src/nsPrefBranch.h index 9db210df563..ed629e68630 100644 --- a/modules/libpref/src/nsPrefBranch.h +++ b/modules/libpref/src/nsPrefBranch.h @@ -187,7 +187,6 @@ public: NS_DECL_NSIOBSERVER nsPrefBranch(const char *aPrefRoot, bool aDefaultBranch); - virtual ~nsPrefBranch(); int32_t GetRootLength() { return mPrefRootLength; } @@ -198,6 +197,8 @@ public: size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf); protected: + virtual ~nsPrefBranch(); + nsPrefBranch() /* disallow use of this constructer */ { } @@ -232,7 +233,6 @@ class nsPrefLocalizedString : public nsIPrefLocalizedString, { public: nsPrefLocalizedString(); - virtual ~nsPrefLocalizedString(); NS_DECL_ISUPPORTS NS_FORWARD_NSISUPPORTSSTRING(mUnicodeString->) @@ -241,6 +241,8 @@ public: nsresult Init(); private: + virtual ~nsPrefLocalizedString(); + NS_IMETHOD GetData(char16_t**); NS_IMETHOD SetData(const char16_t* aData); NS_IMETHOD SetDataWithLength(uint32_t aLength, const char16_t *aData); @@ -254,11 +256,12 @@ class nsRelativeFilePref : public nsIRelativeFilePref public: NS_DECL_ISUPPORTS NS_DECL_NSIRELATIVEFILEPREF - - nsRelativeFilePref(); - virtual ~nsRelativeFilePref(); - + + nsRelativeFilePref(); + private: + virtual ~nsRelativeFilePref(); + nsCOMPtr mFile; nsCString mRelativeToKey; };