Ignore:
Timestamp:
Nov 30, 2011, 8:39:02 AM (14 years ago)
Author:
Adam Roben
Message:

Fix RetainPtr's move assignment operators

Fixes <http://webkit.org/b/73449> RetainPtr's move assignment operators don't modify the
pointer being assigned to

I didn't write a test for this because we don't have a way of unit testing C++11 code (see
<http://webkit.org/b/73448>).

Reviewed by Anders Carlsson.

  • wtf/RetainPtr.h:

(WTF::RetainPtr::operator=): Adopt the passed-in RetainPtr's underlying pointer, not our own
pointer.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/wtf/RetainPtr.h

    r101450 r101521  
    187187    template<typename T> inline RetainPtr<T>& RetainPtr<T>::operator=(RetainPtr<T>&& o)
    188188    {
    189         adoptCF(leakRef());
     189        adoptCF(o.leakRef());
    190190        return *this;
    191191    }
     
    193193    template<typename T> template<typename U> inline RetainPtr<T>& RetainPtr<T>::operator=(RetainPtr<U>&& o)
    194194    {
    195         adoptCF(leakRef());
     195        adoptCF(o.leakRef());
    196196        return *this;
    197197    }
Note: See TracChangeset for help on using the changeset viewer.