[Libreoffice-commits] core.git: pyuno/inc
Caolán McNamara
caolanm at redhat.com
Fri Sep 23 16:16:06 UTC 2016
pyuno/inc/pyuno.hxx | 16 +++++++++++++---
1 file changed, 13 insertions(+), 3 deletions(-)
New commits:
commit c136c978751e6d3f86fd2ca6c3d468049c0d3f51
Author: Caolán McNamara <caolanm at redhat.com>
Date: Fri Sep 23 11:59:16 2016 +0100
coverity#1371219 Missing move assignment operator
Change-Id: I72ed6082b561079b45e82d8258fa1abbe23117e2
Reviewed-on: https://gerrit.libreoffice.org/29228
Reviewed-by: Caolán McNamara <caolanm at redhat.com>
Tested-by: Caolán McNamara <caolanm at redhat.com>
diff --git a/pyuno/inc/pyuno.hxx b/pyuno/inc/pyuno.hxx
index c80d9b1..bd11666 100644
--- a/pyuno/inc/pyuno.hxx
+++ b/pyuno/inc/pyuno.hxx
@@ -101,7 +101,8 @@ public:
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 ); }
@@ -113,11 +114,20 @@ public:
return m;
}
- PyRef & operator = ( const PyRef & r )
+ PyRef& operator=(const PyRef& r)
{
PyObject *tmp = m;
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;
}
More information about the Libreoffice-commits
mailing list