diff --git a/editor/composer/src/nsComposeTxtSrvFilter.h b/editor/composer/src/nsComposeTxtSrvFilter.h index 6a27ca9b0cad..4a6517a80a0c 100644 --- a/editor/composer/src/nsComposeTxtSrvFilter.h +++ b/editor/composer/src/nsComposeTxtSrvFilter.h @@ -31,6 +31,8 @@ public: void Init(bool aIsForMail) { mIsForMail = aIsForMail; } private: + ~nsComposeTxtSrvFilter() {} + bool mIsForMail; }; diff --git a/editor/composer/src/nsComposerCommands.h b/editor/composer/src/nsComposerCommands.h index 03d068c3d617..90325f419802 100644 --- a/editor/composer/src/nsComposerCommands.h +++ b/editor/composer/src/nsComposerCommands.h @@ -27,14 +27,16 @@ class nsString; // instance). class nsBaseComposerCommand : public nsIControllerCommand { +protected: + virtual ~nsBaseComposerCommand() {} + public: - nsBaseComposerCommand(); - virtual ~nsBaseComposerCommand() {} - + nsBaseComposerCommand(); + // nsISupports NS_DECL_ISUPPORTS - + // nsIControllerCommand. Declared longhand so we can make them pure virtual NS_IMETHOD IsCommandEnabled(const char * aCommandName, nsISupports *aCommandRefCon, bool *_retval) = 0; NS_IMETHOD DoCommand(const char * aCommandName, nsISupports *aCommandRefCon) = 0; @@ -54,13 +56,13 @@ class nsBaseStateUpdatingCommand : public nsBaseComposerCommand { public: nsBaseStateUpdatingCommand(nsIAtom* aTagName); - virtual ~nsBaseStateUpdatingCommand(); - + NS_DECL_ISUPPORTS_INHERITED NS_DECL_NSICONTROLLERCOMMAND protected: + virtual ~nsBaseStateUpdatingCommand(); // get the current state (on or off) for this style or block format virtual nsresult GetCurrentState(nsIEditor* aEditor, nsICommandParams* aParams) = 0; @@ -94,13 +96,13 @@ class nsInsertTagCommand : public nsBaseComposerCommand { public: explicit nsInsertTagCommand(nsIAtom* aTagName); - virtual ~nsInsertTagCommand(); NS_DECL_ISUPPORTS_INHERITED NS_DECL_NSICONTROLLERCOMMAND protected: + virtual ~nsInsertTagCommand(); nsIAtom* mTagName; }; @@ -139,13 +141,13 @@ class nsMultiStateCommand : public nsBaseComposerCommand { public: - nsMultiStateCommand(); - virtual ~nsMultiStateCommand(); + nsMultiStateCommand(); NS_DECL_ISUPPORTS_INHERITED NS_DECL_NSICONTROLLERCOMMAND protected: + virtual ~nsMultiStateCommand(); virtual nsresult GetCurrentState(nsIEditor *aEditor, nsICommandParams* aParams) =0; virtual nsresult SetState(nsIEditor *aEditor, nsString& newState) = 0; diff --git a/editor/composer/src/nsComposerCommandsUpdater.h b/editor/composer/src/nsComposerCommandsUpdater.h index 0872ae380703..d305611f6d19 100644 --- a/editor/composer/src/nsComposerCommandsUpdater.h +++ b/editor/composer/src/nsComposerCommandsUpdater.h @@ -32,7 +32,6 @@ class nsComposerCommandsUpdater : public nsISelectionListener, public: nsComposerCommandsUpdater(); - virtual ~nsComposerCommandsUpdater(); // nsISupports NS_DECL_ISUPPORTS @@ -69,6 +68,8 @@ public: protected: + virtual ~nsComposerCommandsUpdater(); + enum { eStateUninitialized = -1, eStateOff = false, diff --git a/editor/composer/src/nsEditingSession.h b/editor/composer/src/nsEditingSession.h index 4748ea2ec228..a9e5da0d05c6 100644 --- a/editor/composer/src/nsEditingSession.h +++ b/editor/composer/src/nsEditingSession.h @@ -49,8 +49,7 @@ class nsEditingSession : public nsIEditingSession, { public: - nsEditingSession(); - virtual ~nsEditingSession(); + nsEditingSession(); // nsISupports NS_DECL_ISUPPORTS @@ -62,6 +61,7 @@ public: NS_DECL_NSIEDITINGSESSION protected: + virtual ~nsEditingSession(); nsIDocShell * GetDocShellFromWindow(nsIDOMWindow *aWindow); diff --git a/editor/composer/src/nsEditorSpellCheck.cpp b/editor/composer/src/nsEditorSpellCheck.cpp index e78100a564c8..1cc3d70ef375 100644 --- a/editor/composer/src/nsEditorSpellCheck.cpp +++ b/editor/composer/src/nsEditorSpellCheck.cpp @@ -144,6 +144,8 @@ public: nsString mDictionary; private: + ~DictionaryFetcher() {} + nsRefPtr mSpellCheck; }; NS_IMPL_ISUPPORTS(DictionaryFetcher, nsIContentPrefCallback2) diff --git a/editor/composer/src/nsEditorSpellCheck.h b/editor/composer/src/nsEditorSpellCheck.h index 8bbcce346f63..eaead526fd47 100644 --- a/editor/composer/src/nsEditorSpellCheck.h +++ b/editor/composer/src/nsEditorSpellCheck.h @@ -33,7 +33,6 @@ class nsEditorSpellCheck : public nsIEditorSpellCheck public: nsEditorSpellCheck(); - virtual ~nsEditorSpellCheck(); NS_DECL_CYCLE_COLLECTING_ISUPPORTS NS_DECL_CYCLE_COLLECTION_CLASS(nsEditorSpellCheck) @@ -42,6 +41,8 @@ public: NS_DECL_NSIEDITORSPELLCHECK protected: + virtual ~nsEditorSpellCheck(); + nsCOMPtr mSpellChecker; nsTArray mSuggestedWordList; diff --git a/editor/libeditor/base/EditTxn.h b/editor/libeditor/base/EditTxn.h index dc3e752d8c6b..87d01e389b51 100644 --- a/editor/libeditor/base/EditTxn.h +++ b/editor/libeditor/base/EditTxn.h @@ -22,13 +22,14 @@ public: NS_DECL_CYCLE_COLLECTING_ISUPPORTS NS_DECL_CYCLE_COLLECTION_CLASS_AMBIGUOUS(EditTxn, nsITransaction) - virtual ~EditTxn(); - virtual void LastRelease() {} NS_IMETHOD RedoTransaction(void); NS_IMETHOD GetIsTransient(bool *aIsTransient); NS_IMETHOD Merge(nsITransaction *aTransaction, bool *aDidMerge); + +protected: + virtual ~EditTxn(); }; #define NS_DECL_EDITTXN \ diff --git a/editor/libeditor/base/nsEditor.h b/editor/libeditor/base/nsEditor.h index c5f450801897..00dc8b4d1772 100644 --- a/editor/libeditor/base/nsEditor.h +++ b/editor/libeditor/base/nsEditor.h @@ -159,11 +159,14 @@ public: * after the construction of the editor class. */ nsEditor(); + +protected: /** The default destructor. This should suffice. Should this be pure virtual * for someone to derive from the nsEditor later? I don't believe so. */ virtual ~nsEditor(); +public: //Interfaces for addref and release and queryinterface //NOTE: Use NS_DECL_ISUPPORTS_INHERITED in any class inherited from nsEditor NS_DECL_CYCLE_COLLECTING_ISUPPORTS diff --git a/editor/libeditor/base/nsEditorCommands.h b/editor/libeditor/base/nsEditorCommands.h index f386751ee839..fdb6f47c5e08 100644 --- a/editor/libeditor/base/nsEditorCommands.h +++ b/editor/libeditor/base/nsEditorCommands.h @@ -19,15 +19,15 @@ class nsISupports; class nsBaseEditorCommand : public nsIControllerCommand { public: - - nsBaseEditorCommand(); - virtual ~nsBaseEditorCommand() {} + nsBaseEditorCommand(); NS_DECL_ISUPPORTS NS_IMETHOD IsCommandEnabled(const char * aCommandName, nsISupports *aCommandRefCon, bool *_retval) = 0; NS_IMETHOD DoCommand(const char *aCommandName, nsISupports *aCommandRefCon) = 0; - + +protected: + virtual ~nsBaseEditorCommand() {} }; diff --git a/editor/libeditor/base/nsEditorEventListener.h b/editor/libeditor/base/nsEditorEventListener.h index 5e01ff7dbed3..2b80e23bae46 100644 --- a/editor/libeditor/base/nsEditorEventListener.h +++ b/editor/libeditor/base/nsEditorEventListener.h @@ -34,7 +34,6 @@ class nsEditorEventListener : public nsIDOMEventListener { public: nsEditorEventListener(); - virtual ~nsEditorEventListener(); virtual nsresult Connect(nsEditor* aEditor); @@ -60,6 +59,8 @@ public: void SpellCheckIfNeeded(); protected: + virtual ~nsEditorEventListener(); + nsresult InstallToEditor(); void UninstallFromEditor(); diff --git a/editor/libeditor/html/TypeInState.h b/editor/libeditor/html/TypeInState.h index 352008dc492a..246e4340b2c4 100644 --- a/editor/libeditor/html/TypeInState.h +++ b/editor/libeditor/html/TypeInState.h @@ -38,7 +38,6 @@ public: TypeInState(); void Reset(); - virtual ~TypeInState(); nsresult UpdateSelState(nsISelection *aSelection); @@ -72,6 +71,7 @@ public: static bool FindPropInList(nsIAtom *aProp, const nsAString &aAttr, nsAString *outValue, nsTArray &aList, int32_t &outIndex); protected: + virtual ~TypeInState(); void RemovePropFromSetList(nsIAtom* aProp, const nsAString& aAttr); void RemovePropFromClearedList(nsIAtom* aProp, const nsAString& aAttr); diff --git a/editor/libeditor/html/nsHTMLAnonymousUtils.cpp b/editor/libeditor/html/nsHTMLAnonymousUtils.cpp index 345424232bae..96aeba1f0813 100644 --- a/editor/libeditor/html/nsHTMLAnonymousUtils.cpp +++ b/editor/libeditor/html/nsHTMLAnonymousUtils.cpp @@ -101,6 +101,7 @@ public: NS_DECL_ISUPPORTS NS_DECL_NSIMUTATIONOBSERVER protected: + ~nsElementDeletionObserver() {} nsINode* mNativeAnonNode; nsINode* mObservedNode; }; diff --git a/editor/libeditor/html/nsHTMLObjectResizer.h b/editor/libeditor/html/nsHTMLObjectResizer.h index 6f807bbc320f..2140450a19ae 100644 --- a/editor/libeditor/html/nsHTMLObjectResizer.h +++ b/editor/libeditor/html/nsHTMLObjectResizer.h @@ -33,7 +33,6 @@ public: ResizerSelectionListener(nsIHTMLEditor * aEditor); void Reset(); - virtual ~ResizerSelectionListener(); /*interfaces for addref and release and queryinterface*/ NS_DECL_ISUPPORTS @@ -41,6 +40,7 @@ public: NS_DECL_NSISELECTIONLISTENER protected: + virtual ~ResizerSelectionListener(); nsWeakPtr mEditor; }; @@ -53,8 +53,6 @@ class ResizerMouseMotionListener : public nsIDOMEventListener { public: ResizerMouseMotionListener(nsIHTMLEditor * aEditor); - virtual ~ResizerMouseMotionListener(); - /*interfaces for addref and release and queryinterface*/ NS_DECL_ISUPPORTS @@ -62,6 +60,8 @@ public: NS_DECL_NSIDOMEVENTLISTENER protected: + virtual ~ResizerMouseMotionListener(); + nsWeakPtr mEditor; }; @@ -74,7 +74,6 @@ class DocumentResizeEventListener: public nsIDOMEventListener { public: DocumentResizeEventListener(nsIHTMLEditor * aEditor); - virtual ~DocumentResizeEventListener(); /*interfaces for addref and release and queryinterface*/ NS_DECL_ISUPPORTS @@ -82,6 +81,7 @@ public: NS_DECL_NSIDOMEVENTLISTENER protected: + virtual ~DocumentResizeEventListener(); nsWeakPtr mEditor; }; diff --git a/editor/libeditor/html/nsHTMLURIRefObject.h b/editor/libeditor/html/nsHTMLURIRefObject.h index 276e771da4df..bd1389835564 100644 --- a/editor/libeditor/html/nsHTMLURIRefObject.h +++ b/editor/libeditor/html/nsHTMLURIRefObject.h @@ -39,6 +39,14 @@ protected: uint32_t mAttributeCnt; }; +namespace mozilla { +template<> +struct HasDangerousPublicDestructor +{ + static const bool value = true; +}; +} + nsresult NS_NewHTMLURIRefObject(nsIURIRefObject** aResult, nsIDOMNode* aNode); #endif /* nsHTMLURIRefObject_h__ */ diff --git a/editor/libeditor/text/nsTextEditRules.h b/editor/libeditor/text/nsTextEditRules.h index f6b4c73393b2..5db7c32edae8 100644 --- a/editor/libeditor/text/nsTextEditRules.h +++ b/editor/libeditor/text/nsTextEditRules.h @@ -43,9 +43,8 @@ public: NS_DECL_NSITIMERCALLBACK NS_DECL_CYCLE_COLLECTING_ISUPPORTS NS_DECL_CYCLE_COLLECTION_CLASS_AMBIGUOUS(nsTextEditRules, nsIEditRules) - - nsTextEditRules(); - virtual ~nsTextEditRules(); + + nsTextEditRules(); // nsIEditRules methods NS_IMETHOD Init(nsPlaintextEditor *aEditor); @@ -61,6 +60,9 @@ public: NS_IMETHOD DocumentIsEmpty(bool *aDocumentIsEmpty); NS_IMETHOD DocumentModified(); +protected: + virtual ~nsTextEditRules(); + public: void ResetIMETextPWBuf(); diff --git a/editor/txmgr/src/nsTransactionItem.h b/editor/txmgr/src/nsTransactionItem.h index 518f3d78d819..ff846415997b 100644 --- a/editor/txmgr/src/nsTransactionItem.h +++ b/editor/txmgr/src/nsTransactionItem.h @@ -26,7 +26,6 @@ class nsTransactionItem public: nsTransactionItem(nsITransaction *aTransaction); - virtual ~nsTransactionItem(); NS_METHOD_(MozExternalRefCountType) AddRef(); NS_METHOD_(MozExternalRefCountType) Release(); @@ -60,6 +59,8 @@ private: void CleanUp(); protected: + virtual ~nsTransactionItem(); + nsCycleCollectingAutoRefCnt mRefCnt; NS_DECL_OWNINGTHREAD }; diff --git a/editor/txmgr/src/nsTransactionList.h b/editor/txmgr/src/nsTransactionList.h index 5668f1151087..32733fe09c88 100644 --- a/editor/txmgr/src/nsTransactionList.h +++ b/editor/txmgr/src/nsTransactionList.h @@ -27,13 +27,14 @@ private: nsTransactionStack *mTxnStack; nsRefPtr mTxnItem; +protected: + virtual ~nsTransactionList(); + public: nsTransactionList(nsITransactionManager *aTxnMgr, nsTransactionStack *aTxnStack); nsTransactionList(nsITransactionManager *aTxnMgr, nsTransactionItem *aTxnItem); - virtual ~nsTransactionList(); - /* Macro for AddRef(), Release(), and QueryInterface() */ NS_DECL_ISUPPORTS diff --git a/editor/txmgr/src/nsTransactionManager.h b/editor/txmgr/src/nsTransactionManager.h index 72486fa116ff..7a4082898cc6 100644 --- a/editor/txmgr/src/nsTransactionManager.h +++ b/editor/txmgr/src/nsTransactionManager.h @@ -34,16 +34,16 @@ private: nsTransactionStack mRedoStack; nsCOMArray mListeners; + /** The default destructor. + */ + virtual ~nsTransactionManager(); + public: /** The default constructor. */ nsTransactionManager(int32_t aMaxTransactionCount=-1); - /** The default destructor. - */ - virtual ~nsTransactionManager(); - /* Macro for AddRef(), Release(), and QueryInterface() */ NS_DECL_CYCLE_COLLECTING_ISUPPORTS NS_DECL_CYCLE_COLLECTION_CLASS_AMBIGUOUS(nsTransactionManager, diff --git a/editor/txmgr/tests/TestTXMgr.cpp b/editor/txmgr/tests/TestTXMgr.cpp index 7373db175b50..46dab4cf532a 100644 --- a/editor/txmgr/tests/TestTXMgr.cpp +++ b/editor/txmgr/tests/TestTXMgr.cpp @@ -405,10 +405,12 @@ int32_t sAggregateBatchTestRedoOrderArr[] = { class TestTransaction : public nsITransaction { +protected: + virtual ~TestTransaction() {} + public: TestTransaction() {} - virtual ~TestTransaction() {} NS_DECL_ISUPPORTS }; diff --git a/editor/txtsvc/src/nsFilteredContentIterator.h b/editor/txtsvc/src/nsFilteredContentIterator.h index ccaea42e841c..4d9d006855fa 100644 --- a/editor/txtsvc/src/nsFilteredContentIterator.h +++ b/editor/txtsvc/src/nsFilteredContentIterator.h @@ -74,4 +74,12 @@ protected: eDirectionType mDirection; }; +namespace mozilla { +template<> +struct HasDangerousPublicDestructor +{ + static const bool value = true; +}; +} + #endif diff --git a/editor/txtsvc/src/nsTextServicesDocument.h b/editor/txtsvc/src/nsTextServicesDocument.h index 7fa0e6eeadd3..882c28739288 100644 --- a/editor/txtsvc/src/nsTextServicesDocument.h +++ b/editor/txtsvc/src/nsTextServicesDocument.h @@ -87,16 +87,17 @@ private: nsCOMPtr mTxtSvcFilter; +protected: + /** The default destructor. + */ + virtual ~nsTextServicesDocument(); + public: /** The default constructor. */ nsTextServicesDocument(); - /** The default destructor. - */ - virtual ~nsTextServicesDocument(); - /** To be called at module init */ static void RegisterAtoms();