From ff8c36d435b63a2754fb3003d52276cfceef4c51 Mon Sep 17 00:00:00 2001 From: Daniel Holbert Date: Tue, 1 Apr 2014 17:21:24 -0700 Subject: [PATCH] Bug 984786 part 2: Mark destructor as protected or private in two refcounted a11y classes, and mark one as MOZ_FINAL. r=tbsaunde --- accessible/src/base/NotificationController.h | 7 +++++-- accessible/src/base/SelectionManager.cpp | 8 ++++++-- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/accessible/src/base/NotificationController.h b/accessible/src/base/NotificationController.h index f66830afce3..5523d57ef0e 100644 --- a/accessible/src/base/NotificationController.h +++ b/accessible/src/base/NotificationController.h @@ -26,8 +26,6 @@ class DocAccessible; class Notification { public: - virtual ~Notification() { } - NS_INLINE_DECL_REFCOUNTING(Notification) /** @@ -38,6 +36,11 @@ public: protected: Notification() { } + /** + * Protected destructor, to discourage deletion outside of Release(): + */ + virtual ~Notification() { } + private: Notification(const Notification&); Notification& operator = (const Notification&); diff --git a/accessible/src/base/SelectionManager.cpp b/accessible/src/base/SelectionManager.cpp index afc556b286e..c5bdeb6b996 100644 --- a/accessible/src/base/SelectionManager.cpp +++ b/accessible/src/base/SelectionManager.cpp @@ -20,7 +20,7 @@ using namespace mozilla; using namespace mozilla::a11y; -struct mozilla::a11y::SelData +struct mozilla::a11y::SelData MOZ_FINAL { SelData(Selection* aSel, int32_t aReason) : mSel(aSel), mReason(aReason) {} @@ -28,7 +28,11 @@ struct mozilla::a11y::SelData nsRefPtr mSel; int16_t mReason; - NS_INLINE_DECL_REFCOUNTING(SelData); + NS_INLINE_DECL_REFCOUNTING(SelData) + +private: + // Private destructor, to discourage deletion outside of Release(): + ~SelData() {} }; void