commit d1a76b53ffd0876efbe77c22b8b181843eebfd57 Author: Milan Sreckovic milan@mozilla.com Date: Wed May 7 15:31:52 2014 -0400
Bug 994907 - imgDecoderObserver does reference counting on different threads, so should be using thread safe reference counting. r=sfowler, r=ehsan, a=abillings --- image/src/imgDecoderObserver.h | 7 +++++-- image/src/imgStatusTracker.cpp | 5 +++-- 2 files changed, 8 insertions(+), 4 deletions(-)
diff --git a/image/src/imgDecoderObserver.h b/image/src/imgDecoderObserver.h index 138f6b0..06d1798 100644 --- a/image/src/imgDecoderObserver.h +++ b/image/src/imgDecoderObserver.h @@ -32,10 +32,10 @@ * loaded data fire before the call returns. If FLAG_SYNC_DECODE is not passed, * all, some, or none of the notifications may fire before the call returns. */ -class imgDecoderObserver : public mozilla::RefCounted<imgDecoderObserver> +class imgDecoderObserver { public: - virtual ~imgDecoderObserver() = 0; + NS_INLINE_DECL_THREADSAFE_REFCOUNTING(imgDecoderObserver);
/** * Load notification. @@ -124,6 +124,9 @@ public: * Called when an image is realized to be in error state. */ virtual void OnError() = 0; + +protected: + virtual ~imgDecoderObserver() = 0; };
// We must define a destructor because derived classes call our destructor from diff --git a/image/src/imgStatusTracker.cpp b/image/src/imgStatusTracker.cpp index 06a352b..99c8f48 100644 --- a/image/src/imgStatusTracker.cpp +++ b/image/src/imgStatusTracker.cpp @@ -228,8 +228,6 @@ public: imgStatusTrackerObserver(imgStatusTracker* aTracker) : mTracker(aTracker) {}
- virtual ~imgStatusTrackerObserver() {} - void SetTracker(imgStatusTracker* aTracker) { mTracker = aTracker; } @@ -317,6 +315,9 @@ public: mTracker->RecordError(); }
+protected: + virtual ~imgStatusTrackerObserver() {} + private: imgStatusTracker* mTracker; };
tbb-commits@lists.torproject.org