Bug 758992 - Make the classes which use the XPCOM nsISupports implementation macros final, to avoid the warning about deleting using a pointer to a base class with virtual functions and no virtual dtor (widget/windows parts); r=bsmedberg
authorJacek Caban <jacek@codeweavers.com>
Thu, 14 Jun 2012 14:28:06 -0400
changeset 101526 6ac5b95215d219dc6f24b7d63dc9f601f366a22a
parent 101525 7d8008a0ab816a370ef438be4cd80d29fe9fd824
child 101527 086c2e7be28ac5b40b247b50fd8a57b81024d251
push id1316
push userakeybl@mozilla.com
push dateMon, 27 Aug 2012 22:37:00 +0000
treeherdermozilla-beta@db4b09302ee2 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbsmedberg
bugs758992
milestone16.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 758992 - Make the classes which use the XPCOM nsISupports implementation macros final, to avoid the warning about deleting using a pointer to a base class with virtual functions and no virtual dtor (widget/windows parts); r=bsmedberg
widget/windows/AudioSession.cpp
widget/windows/IEnumFE.h
widget/windows/JumpListBuilder.h
widget/windows/WinTaskbar.cpp
widget/windows/WinTaskbar.h
widget/windows/nsDataObj.h
widget/windows/nsDataObjCollection.h
widget/windows/nsDeviceContextSpecWin.h
widget/windows/nsNativeDragSource.h
widget/windows/nsNativeDragTarget.h
widget/windows/nsScreenManagerWin.h
widget/windows/nsTextStore.h
--- a/widget/windows/AudioSession.cpp
+++ b/widget/windows/AudioSession.cpp
@@ -14,28 +14,29 @@
 
 //#include "AudioSession.h"
 #include "nsCOMPtr.h"
 #include "nsAutoPtr.h"
 #include "nsServiceManagerUtils.h"
 #include "nsString.h"
 #include "nsThreadUtils.h"
 #include "nsXULAppAPI.h"
+#include "mozilla/Attributes.h"
 
 #include <objbase.h>
 
 namespace mozilla {
 namespace widget {
 
 /* 
  * To take advantage of what Vista+ have to offer with respect to audio,
  * we need to maintain an audio session.  This class wraps IAudioSessionControl
  * and implements IAudioSessionEvents (for callbacks from Windows)
  */
-class AudioSession: public IAudioSessionEvents {
+class AudioSession MOZ_FINAL : public IAudioSessionEvents {
 private:
   AudioSession();
   ~AudioSession();
 public:
   static AudioSession* GetSingleton();
 
   // COM IUnknown
   STDMETHODIMP_(ULONG) AddRef();
--- a/widget/windows/IEnumFE.h
+++ b/widget/windows/IEnumFE.h
@@ -8,16 +8,17 @@
 
 /*
  * CEnumFormatEtc - implements IEnumFORMATETC
  */
 
 #include <ole2.h>
 
 #include "nsTArray.h"
+#include "mozilla/Attributes.h"
 
 // FORMATETC container
 class FormatEtc
 {
 public:
   FormatEtc() { memset(&mFormat, 0, sizeof(FORMATETC)); }
   FormatEtc(const FormatEtc& copy) { CopyIn(&copy.mFormat); }
   ~FormatEtc() { if (mFormat.ptd) CoTaskMemFree(mFormat.ptd); }
@@ -51,17 +52,17 @@ private:
 /*
  * CEnumFormatEtc is created within IDataObject::EnumFormatEtc. This object lives
  * on its own, that is, QueryInterface only knows IUnknown and IEnumFormatEtc,
  * nothing more.  We still use an outer unknown for reference counting, because as
  * long as this enumerator lives, the data object should live, thereby keeping the
  * application up.
  */
 
-class CEnumFormatEtc : public IEnumFORMATETC
+class CEnumFormatEtc MOZ_FINAL : public IEnumFORMATETC
 {
 public:
     CEnumFormatEtc(nsTArray<FormatEtc>& aArray);
     CEnumFormatEtc();
     ~CEnumFormatEtc();
 
     // IUnknown impl.
     STDMETHODIMP QueryInterface(REFIID riid, LPVOID *ppv);
--- a/widget/windows/JumpListBuilder.h
+++ b/widget/windows/JumpListBuilder.h
@@ -17,16 +17,17 @@
 #include "nsIMutableArray.h"
 
 #include "nsIJumpListBuilder.h"
 #include "nsIJumpListItem.h"
 #include "JumpListItem.h"
 #include "nsIObserver.h"
 #include "nsIFaviconService.h"
 #include "nsThreadUtils.h"
+#include "mozilla/Attributes.h"
 
 namespace mozilla {
 namespace widget {
 
 class JumpListBuilder : public nsIJumpListBuilder, 
                         public nsIObserver
 {
 public:
@@ -50,17 +51,17 @@ private:
   nsresult TransferIObjectArrayToIMutableArray(IObjectArray *objArray, nsIMutableArray *removedItems);
   nsresult RemoveIconCacheForItems(nsIMutableArray *removedItems);
   nsresult RemoveIconCacheForAllItems();
 
   friend class WinTaskbar;
 };
 
 
-class AsyncFaviconDataReady : public nsIFaviconDataCallback
+class AsyncFaviconDataReady MOZ_FINAL : public nsIFaviconDataCallback
 {
 public:
   NS_DECL_ISUPPORTS
   NS_DECL_NSIFAVICONDATACALLBACK
 
   AsyncFaviconDataReady(nsIURI *aNewURI, nsCOMPtr<nsIThread> &aIOThread);
 private:
   nsCOMPtr<nsIURI> mNewURI;
--- a/widget/windows/WinTaskbar.cpp
+++ b/widget/windows/WinTaskbar.cpp
@@ -114,17 +114,17 @@ SetWindowAppUserModelProp(nsIDOMWindow *
   FreeLibrary(hDLL);
 
   return rv;
 }
 
 ///////////////////////////////////////////////////////////////////////////////
 // default nsITaskbarPreviewController
 
-class DefaultController : public nsITaskbarPreviewController
+class DefaultController MOZ_FINAL : public nsITaskbarPreviewController
 {
   HWND mWnd;
 public:
   DefaultController(HWND hWnd) 
     : mWnd(hWnd)
   {
   }
 
--- a/widget/windows/WinTaskbar.h
+++ b/widget/windows/WinTaskbar.h
@@ -6,21 +6,22 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #ifndef __WinTaskbar_h__
 #define __WinTaskbar_h__
 
 #include <windows.h>
 #include <shobjidl.h>
 #include "nsIWinTaskbar.h"
+#include "mozilla/Attributes.h"
 
 namespace mozilla {
 namespace widget {
 
-class WinTaskbar : public nsIWinTaskbar
+class WinTaskbar MOZ_FINAL : public nsIWinTaskbar
 {
 public: 
   WinTaskbar();
   ~WinTaskbar();
 
   NS_DECL_ISUPPORTS
   NS_DECL_NSIWINTASKBAR
 
--- a/widget/windows/nsDataObj.h
+++ b/widget/windows/nsDataObj.h
@@ -82,17 +82,17 @@ class nsITransferable;
  * can be adapted by an object derived from CfDragDrop. The CfDragDrop is
  * associated with instances via SetDragDrop().
  */
 class nsDataObj : public IDataObject,
                   public IAsyncOperation
 {
   public: // construction, destruction
     nsDataObj(nsIURI *uri = nsnull);
-    ~nsDataObj();
+    virtual ~nsDataObj();
 
 	public: // IUnknown methods - see iunknown.h for documentation
 		STDMETHODIMP_(ULONG) AddRef        ();
 		STDMETHODIMP 			QueryInterface(REFIID, void**);
 		STDMETHODIMP_(ULONG) Release       ();
 
     // support for clipboard
     void AddDataFlavor(const char* aDataFlavor, LPFORMATETC aFE);
--- a/widget/windows/nsDataObjCollection.h
+++ b/widget/windows/nsDataObjCollection.h
@@ -7,16 +7,17 @@
 #define _NSDATAOBJCOLLECTION_H_
 
 #include <oleidl.h>
 
 #include "nsString.h"
 #include "nsTArray.h"
 #include "nsAutoPtr.h"
 #include "nsDataObj.h"
+#include "mozilla/Attributes.h"
 
 class CEnumFormatEtc;
 
 #define MULTI_MIME "Mozilla/IDataObjectCollectionFormat"
 
 EXTERN_C const IID IID_IDataObjCollection;
 
 // An interface to make sure we have the right kind of object for D&D
@@ -27,17 +28,17 @@ public:
 };
 
 /*
  * This ole registered class is used to facilitate drag-drop of objects which
  * can be adapted by an object derived from CfDragDrop. The CfDragDrop is
  * associated with instances via SetDragDrop().
  */
  
-class nsDataObjCollection : public nsIDataObjCollection, public nsDataObj
+class nsDataObjCollection MOZ_FINAL : public nsIDataObjCollection, public nsDataObj
 {
   public:
     nsDataObjCollection();
     ~nsDataObjCollection();
 
   public: // IUnknown methods - see iunknown.h for documentation
     STDMETHODIMP_(ULONG) AddRef        ();
     STDMETHODIMP       QueryInterface(REFIID, void**);
--- a/widget/windows/nsDeviceContextSpecWin.h
+++ b/widget/windows/nsDeviceContextSpecWin.h
@@ -7,16 +7,17 @@
 #define nsDeviceContextSpecWin_h___
 
 #include "nsCOMPtr.h"
 #include "nsIDeviceContextSpec.h"
 #include "nsIPrintOptions.h" // For nsIPrinterEnumerator
 #include "nsIPrintSettings.h"
 #include "nsISupportsPrimitives.h"
 #include <windows.h>
+#include "mozilla/Attributes.h"
 
 class nsIWidget;
 
 class nsDeviceContextSpecWin : public nsIDeviceContextSpec
 {
 public:
   nsDeviceContextSpecWin();
 
@@ -64,17 +65,17 @@ protected:
 
   nsCOMPtr<nsIPrintSettings> mPrintSettings;
 };
 
 
 //-------------------------------------------------------------------------
 // Printer Enumerator
 //-------------------------------------------------------------------------
-class nsPrinterEnumeratorWin : public nsIPrinterEnumerator
+class nsPrinterEnumeratorWin MOZ_FINAL : public nsIPrinterEnumerator
 {
 public:
   nsPrinterEnumeratorWin();
   ~nsPrinterEnumeratorWin();
   NS_DECL_ISUPPORTS
   NS_DECL_NSIPRINTERENUMERATOR
 };
 
--- a/widget/windows/nsNativeDragSource.h
+++ b/widget/windows/nsNativeDragSource.h
@@ -5,24 +5,25 @@
 #ifndef _nsNativeDragSource_h_
 #define _nsNativeDragSource_h_
 
 #include "nscore.h"
 #include "nsIDOMDataTransfer.h"
 #include "nsCOMPtr.h"
 #include <ole2.h>
 #include <oleidl.h>
+#include "mozilla/Attributes.h"
 
 //class nsIDragSource;
 
 /*
  * nsNativeDragSource implements the IDropSource interface and gets
  * most of its behavior from the associated adapter (m_dragDrop).
  */
-class nsNativeDragSource : public IDropSource
+class nsNativeDragSource MOZ_FINAL : public IDropSource
 {
 public:
 
   // construct an nsNativeDragSource referencing adapter
   // nsNativeDragSource(nsIDragSource * adapter);
   nsNativeDragSource(nsIDOMDataTransfer* aDataTransfer);
   ~nsNativeDragSource();
 
--- a/widget/windows/nsNativeDragTarget.h
+++ b/widget/windows/nsNativeDragTarget.h
@@ -9,27 +9,29 @@
 #include "nsIDragSession.h"
 #include <ole2.h>
 #include <shlobj.h>
 
 #ifndef IDropTargetHelper
 #include <shobjidl.h> // Vista drag image interfaces
 #endif
 
+#include "mozilla/Attributes.h"
+
 class nsIDragService;
 class nsIWidget;
 
 struct IDataObject;
 
 /*
  * nsNativeDragTarget implements the IDropTarget interface and gets most of its
  * behavior from the associated adapter (m_dragDrop).
  */
 
-class nsNativeDragTarget : public IDropTarget
+class nsNativeDragTarget MOZ_FINAL : public IDropTarget
 {
 public:
   nsNativeDragTarget(nsIWidget * aWnd);
   ~nsNativeDragTarget();
 
   // IUnknown members - see iunknown.h for documentation
   STDMETHODIMP QueryInterface(REFIID, void**);
   STDMETHODIMP_(ULONG) AddRef();
--- a/widget/windows/nsScreenManagerWin.h
+++ b/widget/windows/nsScreenManagerWin.h
@@ -6,32 +6,33 @@
 #ifndef nsScreenManagerWin_h___
 #define nsScreenManagerWin_h___
 
 #include "nsIScreenManager.h"
 
 #include <windows.h>
 #include "nsCOMPtr.h"
 #include "nsTArray.h"
+#include "mozilla/Attributes.h"
 
 class nsIScreen;
 
 //------------------------------------------------------------------------
 
 class ScreenListItem
 {
 public:
   ScreenListItem ( HMONITOR inMon, nsIScreen* inScreen )
     : mMon(inMon), mScreen(inScreen) { } ;
   
   HMONITOR mMon;
   nsCOMPtr<nsIScreen> mScreen;
 };
 
-class nsScreenManagerWin : public nsIScreenManager
+class nsScreenManagerWin MOZ_FINAL : public nsIScreenManager
 {
 public:
   nsScreenManagerWin ( );
   ~nsScreenManagerWin();
 
   NS_DECL_ISUPPORTS
   NS_DECL_NSISCREENMANAGER
 
--- a/widget/windows/nsTextStore.h
+++ b/widget/windows/nsTextStore.h
@@ -6,16 +6,17 @@
 #ifndef NSTEXTSTORE_H_
 #define NSTEXTSTORE_H_
 
 #include "nsAutoPtr.h"
 #include "nsString.h"
 #include "nsCOMPtr.h"
 #include "nsITimer.h"
 #include "nsIWidget.h"
+#include "mozilla/Attributes.h"
 
 #include <msctf.h>
 #include <textstor.h>
 
 struct ITfThreadMgr;
 struct ITfDocumentMgr;
 struct ITfDisplayAttributeMgr;
 struct ITfCategoryMgr;
@@ -26,18 +27,18 @@ class nsTextEvent;
 // during a mutation observer call because things get broken.
 // So we post a message and notify TSF when we get it later.
 #define WM_USER_TSF_TEXTCHANGE  (WM_USER + 0x100)
 
 /*
  * Text Services Framework text store
  */
 
-class nsTextStore : public ITextStoreACP,
-                    public ITfContextOwnerCompositionSink
+class nsTextStore MOZ_FINAL : public ITextStoreACP,
+                              public ITfContextOwnerCompositionSink
 {
 public: /*IUnknown*/
   STDMETHODIMP_(ULONG)  AddRef(void);
   STDMETHODIMP          QueryInterface(REFIID, void**);
   STDMETHODIMP_(ULONG)  Release(void);
 
 public: /*ITextStoreACP*/
   STDMETHODIMP AdviseSink(REFIID, IUnknown*, DWORD);