Bug 1056941 - Fix dangerous destructors in Fennec code; r=blassey

This commit is contained in:
Jim Chen 2014-08-26 15:07:59 -04:00
parent be8b04e34d
commit 9e2f5981db
22 changed files with 72 additions and 19 deletions

View File

@ -15,6 +15,9 @@ namespace mobilemessage {
class MobileMessageDatabaseService MOZ_FINAL : public nsIMobileMessageDatabaseService
{
private:
~MobileMessageDatabaseService() {}
public:
NS_DECL_ISUPPORTS
NS_DECL_NSIMOBILEMESSAGEDATABASESERVICE

View File

@ -14,6 +14,9 @@ namespace mobilemessage {
class SmsService MOZ_FINAL : public nsISmsService
{
private:
~SmsService() {}
public:
NS_DECL_ISUPPORTS
NS_DECL_NSISMSSERVICE

View File

@ -7,6 +7,9 @@
class nsHapticFeedback MOZ_FINAL : public nsIHapticFeedback
{
private:
~nsHapticFeedback() {}
public:
NS_DECL_ISUPPORTS
NS_DECL_NSIHAPTICFEEDBACK

View File

@ -44,6 +44,9 @@ static FT_Library gPlatformFTLibrary = nullptr;
class FreetypeReporter MOZ_FINAL : public nsIMemoryReporter,
public CountingAllocatorBase<FreetypeReporter>
{
private:
~FreetypeReporter() {}
public:
NS_DECL_ISUPPORTS

View File

@ -25,7 +25,6 @@ class nsIconChannel MOZ_FINAL : public nsIChannel {
NS_FORWARD_NSICHANNEL(mRealChannel->)
nsIconChannel() {}
~nsIconChannel() {}
/**
* Called by nsIconProtocolHandler after it creates this channel.
@ -33,7 +32,10 @@ class nsIconChannel MOZ_FINAL : public nsIChannel {
* If this method fails, no other function must be called on this object.
*/
nsresult Init(nsIURI* aURI);
private:
~nsIconChannel() {}
/**
* The channel to the temp icon file (e.g. to /tmp/2qy9wjqw.html).
* Will always be non-null after a successful Init.

View File

@ -15,11 +15,10 @@ public:
NS_DECL_ISUPPORTS
NS_DECL_NSISHELLSERVICE
nsShellService() {};
nsShellService() {}
private:
~nsShellService() {};
~nsShellService() {}
};
#define nsShellService_CID \

View File

@ -225,9 +225,9 @@ class TicklerTimer MOZ_FINAL : public nsITimerCallback
mTickler = do_GetWeakReference(aTickler);
}
~TicklerTimer() {};
private:
~TicklerTimer() {}
nsWeakPtr mTickler;
};

View File

@ -17,9 +17,11 @@
#include "mozilla/ReentrantMonitor.h"
class AndroidCaptureProvider MOZ_FINAL : public nsDeviceCaptureProvider {
private:
~AndroidCaptureProvider();
public:
AndroidCaptureProvider();
~AndroidCaptureProvider();
NS_DECL_THREADSAFE_ISUPPORTS
@ -28,9 +30,11 @@ class AndroidCaptureProvider MOZ_FINAL : public nsDeviceCaptureProvider {
};
class AndroidCameraInputStream MOZ_FINAL : public nsIAsyncInputStream, mozilla::net::CameraStreamImpl::FrameCallback {
private:
~AndroidCameraInputStream();
public:
AndroidCameraInputStream();
~AndroidCameraInputStream();
NS_IMETHODIMP Init(nsACString& aContentType, nsCaptureParams* aParams);

View File

@ -16,6 +16,8 @@ public:
NS_DECL_NSINETWORKLINKSERVICE
nsAndroidNetworkLinkService();
private:
virtual ~nsAndroidNetworkLinkService();
};

View File

@ -26,7 +26,7 @@ public:
nsresult Init();
private:
~nsAndroidSystemProxySettings() {};
virtual ~nsAndroidSystemProxySettings() {}
};
NS_IMPL_ISUPPORTS(nsAndroidSystemProxySettings, nsISystemProxySettings)

View File

@ -15,14 +15,14 @@ public:
NS_DECL_NSIHANDLERAPP
NS_DECL_NSISHARINGHANDLERAPP
public:
nsAndroidHandlerApp(const nsAString& aName, const nsAString& aDescription,
const nsAString& aPackageName,
const nsAString& aClassName,
const nsACString& aMimeType, const nsAString& aAction);
virtual ~nsAndroidHandlerApp();
private:
virtual ~nsAndroidHandlerApp();
nsString mName;
nsString mDescription;
nsString mPackageName;

View File

@ -30,7 +30,9 @@ public:
nsMIMEInfoAndroid(const nsACString& aMIMEType);
protected:
private:
~nsMIMEInfoAndroid() {}
virtual nsresult LaunchDefaultWithFile(nsIFile* aFile);
virtual nsresult LoadUriInternal(nsIURI *aURI);
nsCOMPtr<nsIMutableArray> mHandlerApps;
@ -40,16 +42,18 @@ protected:
nsHandlerInfoAction mPrefAction;
nsString mDescription;
nsCOMPtr<nsIHandlerApp> mPrefApp;
public:
class SystemChooser MOZ_FINAL : public nsIHandlerApp {
public:
NS_DECL_ISUPPORTS
NS_DECL_NSIHANDLERAPP
SystemChooser(nsMIMEInfoAndroid* aOuter): mOuter(aOuter) {};
SystemChooser(nsMIMEInfoAndroid* aOuter): mOuter(aOuter) {}
private:
~SystemChooser() {}
nsMIMEInfoAndroid* mOuter;
};
};

View File

@ -115,6 +115,10 @@ GfxInfo::GfxInfo()
{
}
GfxInfo::~GfxInfo()
{
}
/* GetD2DEnabled and GetDwriteEnabled shouldn't be called until after gfxPlatform initialization
* has occurred because they depend on it for information. (See bug 591561) */
nsresult

View File

@ -24,6 +24,9 @@ namespace widget {
class GfxInfo : public GfxInfoBase
{
private:
~GfxInfo();
public:
GfxInfo();

View File

@ -25,11 +25,15 @@ public:
mBridgeInputStream = env->NewGlobalRef(GeckoAppShell::CreateInputStream(connection));
mBridgeChannel = env->NewGlobalRef(AndroidBridge::ChannelCreate(mBridgeInputStream));
}
private:
virtual ~AndroidInputStream() {
JNIEnv *env = GetJNIForThread();
env->DeleteGlobalRef(mBridgeInputStream);
env->DeleteGlobalRef(mBridgeChannel);
}
public:
NS_DECL_THREADSAFE_ISUPPORTS
NS_DECL_NSIINPUTSTREAM

View File

@ -29,6 +29,8 @@ public:
// nsAndroidProtocolHandler methods:
nsAndroidProtocolHandler() {}
private:
~nsAndroidProtocolHandler() {}
};

View File

@ -111,7 +111,10 @@ private:
};
class WakeLockListener MOZ_FINAL : public nsIDOMMozWakeLockListener {
public:
private:
~WakeLockListener() {}
public:
NS_DECL_ISUPPORTS;
nsresult Callback(const nsAString& topic, const nsAString& state) {

View File

@ -10,6 +10,9 @@
class nsClipboard MOZ_FINAL : public nsIClipboard
{
private:
~nsClipboard() {}
public:
NS_DECL_ISUPPORTS
NS_DECL_NSICLIPBOARD

View File

@ -7,6 +7,9 @@
class nsDeviceContextSpecAndroid MOZ_FINAL : public nsIDeviceContextSpec
{
private:
~nsDeviceContextSpecAndroid() {}
public:
NS_DECL_ISUPPORTS

View File

@ -30,9 +30,11 @@ protected:
class nsScreenManagerAndroid MOZ_FINAL : public nsIScreenManager
{
private:
~nsScreenManagerAndroid();
public:
nsScreenManagerAndroid();
~nsScreenManagerAndroid();
NS_DECL_ISUPPORTS
NS_DECL_NSISCREENMANAGER

View File

@ -87,6 +87,10 @@ static StaticRefPtr<ContentCreationNotifier> gContentCreationNotifier;
// are created. Currently an update for the screen size is sent.
class ContentCreationNotifier MOZ_FINAL : public nsIObserver
{
private:
~ContentCreationNotifier() {}
public:
NS_DECL_ISUPPORTS
NS_IMETHOD Observe(nsISupports* aSubject,

View File

@ -32,11 +32,13 @@ namespace mozilla {
class nsWindow :
public nsBaseWidget
{
private:
virtual ~nsWindow();
public:
using nsBaseWidget::GetLayerManager;
nsWindow();
virtual ~nsWindow();
NS_DECL_ISUPPORTS_INHERITED