Kaydet (Commit) c136c978 authored tarafından Caolán McNamara's avatar Caolán McNamara

coverity#1371219 Missing move assignment operator

Change-Id: I72ed6082b561079b45e82d8258fa1abbe23117e2
Reviewed-on: https://gerrit.libreoffice.org/29228Reviewed-by: 's avatarCaolán McNamara <caolanm@redhat.com>
Tested-by: 's avatarCaolán McNamara <caolanm@redhat.com>
üst 3de25678
...@@ -101,7 +101,8 @@ public: ...@@ -101,7 +101,8 @@ public:
throw std::bad_alloc(); throw std::bad_alloc();
} }
PyRef( const PyRef &r ) : m( r.get() ) { Py_XINCREF( m ); } PyRef(const PyRef &r) : m(r.get()) { Py_XINCREF(m); }
PyRef(PyRef &&r) : m(r.get()) { r.scratch(); }
~PyRef() { Py_XDECREF( m ); } ~PyRef() { Py_XDECREF( m ); }
...@@ -113,11 +114,20 @@ public: ...@@ -113,11 +114,20 @@ public:
return m; return m;
} }
PyRef & operator = ( const PyRef & r ) PyRef& operator=(const PyRef& r)
{ {
PyObject *tmp = m; PyObject *tmp = m;
m = r.getAcquired(); m = r.getAcquired();
Py_XDECREF( tmp ); Py_XDECREF(tmp);
return *this;
}
PyRef& operator=(PyRef&& r)
{
PyObject *tmp = m;
m = r.get();
r.scratch();
Py_XDECREF(tmp);
return *this; return *this;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment