Bug 1028588 - Fix dangerous public destructors in libpref/ - r=bsmedberg

This commit is contained in:
Benoit Jacob 2014-06-30 18:11:48 -04:00
Родитель e8041c5877
Коммит aaabf35f80
3 изменённых файлов: 17 добавлений и 11 удалений

Просмотреть файл

@ -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.

Просмотреть файл

@ -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

Просмотреть файл

@ -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<nsIFile> mFile;
nsCString mRelativeToKey;
};