Bug 1493045 - Assert thread-safety when destroying WeakPtr r=froydnj
authorJed Davis <jld@mozilla.com>
Wed, 03 Oct 2018 16:41:10 +0000
changeset 495170 5d797c6f6f132d76c04dd556c5c2e9fc0ad3cbcb
parent 495169 bde685714bea04e95e8fc69e4da2cd51039d3bcd
child 495171 a632efc6cac44106f08fe0bdf373a939aad9ca41
push id9984
push userffxbld-merge
push dateMon, 15 Oct 2018 21:07:35 +0000
treeherdermozilla-beta@183d27ea8570 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersfroydnj
bugs1493045
milestone64.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 1493045 - Assert thread-safety when destroying WeakPtr r=froydnj Differential Revision: https://phabricator.services.mozilla.com/D7353
mfbt/WeakPtr.h
--- a/mfbt/WeakPtr.h
+++ b/mfbt/WeakPtr.h
@@ -275,16 +275,20 @@ public:
 
   operator T*() const { return mRef->get(); }
   T& operator*() const { return *mRef->get(); }
 
   T* operator->() const MOZ_NO_ADDREF_RELEASE_ON_RETURN { return mRef->get(); }
 
   T* get() const { return mRef->get(); }
 
+  ~WeakPtr() {
+    MOZ_WEAKPTR_ASSERT_THREAD_SAFETY_DELEGATED(mRef);
+  }
+
 private:
   friend class SupportsWeakPtr<T>;
 
   explicit WeakPtr(const RefPtr<WeakReference>& aOther) : mRef(aOther) {}
 
   RefPtr<WeakReference> mRef;
 };