Bug 702799 - Don't modify a RefPtr when using the implicit conversion to TemporaryRef. r=cjones
authorJoe Drew <joe@drew.ca>
Mon, 21 Nov 2011 16:42:07 -0500
changeset 80597 3b3c9e09abe39372b3d8cb488f1c7e827db9299b
parent 80596 f6be9ad957b1963884b9dc599ac72e34bf7c1c92
child 80598 38e4456727805e36a044ad07bca9000437fb1fcd
push id21511
push userbmo@edmorley.co.uk
push dateTue, 22 Nov 2011 02:38:00 +0000
treeherdermozilla-central@b8955ff00aae [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerscjones
bugs702799
milestone11.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 702799 - Don't modify a RefPtr when using the implicit conversion to TemporaryRef. r=cjones
mfbt/RefPtr.h
--- a/mfbt/RefPtr.h
+++ b/mfbt/RefPtr.h
@@ -169,17 +169,17 @@ public:
         return TemporaryRef<T>(tmp, dontRef());
     }
 
     T* get() const { return ptr; }
     operator T*() const { return ptr; }
     T* operator->() const { return ptr; }
     T& operator*() const { return *ptr; }
     template<typename U>
-    operator TemporaryRef<U>() { return forget(); }
+    operator TemporaryRef<U>() { return TemporaryRef<U>(ptr); }
 
 private:
     void assign(T* t) {
         unref(ptr);
         ptr = t;
     }
 
     T* ptr;