Commit b2b42ad0 authored by Ms2ger's avatar Ms2ger
Browse files

Bug 709747 - Support nsCOMPtr<T>::forget(I**); r=bsmedberg

parent c7eec081
Loading
Loading
Loading
Loading
+6 −4
Original line number Diff line number Diff line
@@ -767,15 +767,17 @@ class nsCOMPtr MOZ_FINAL
          return temp;
        }

      template <typename I>
      void
      forget( T** rhs NS_OUTPARAM )
      forget( I** rhs NS_OUTPARAM )
          // Set the target of rhs to the value of mRawPtr and null out mRawPtr.
          // Useful to avoid unnecessary AddRef/Release pairs with "out"
          // parameters.
          // parameters where rhs bay be a T** or an I** where I is a base class
          // of T.
        {
          NS_ASSERTION(rhs, "Null pointer passed to forget!");
          *rhs = 0;
          swap(*rhs);
          *rhs = get();
          mRawPtr = 0;
        }

      T*