diff options
author | Caolán McNamara <caolanm@redhat.com> | 2016-09-30 09:20:16 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2016-09-30 09:59:47 +0100 |
commit | 673fe197751cca6477c851f6a64674ced768bc49 (patch) | |
tree | f71aec11b5c18e85a2ddcfdbc3a0721b785c598f /include/canvas | |
parent | e214fab7a318f7881d0bd2803f54ce4e1ac2cb83 (diff) |
coverity#1371191 Missing move assignment operator
Change-Id: If543e0685f808cfe72eaa0ff60c87bb3b1a5ea42
Diffstat (limited to 'include/canvas')
-rw-r--r-- | include/canvas/vclwrapper.hxx | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/include/canvas/vclwrapper.hxx b/include/canvas/vclwrapper.hxx index dcef39c89a95..bdda0ce65f8f 100644 --- a/include/canvas/vclwrapper.hxx +++ b/include/canvas/vclwrapper.hxx @@ -79,6 +79,12 @@ namespace canvas mpWrappee = nullptr; } + VCLObject( VCLObject&& rOrig ) + : mpWrappee(rOrig.mpWrappee) + { + rOrig.mpWrappee = nullptr; + } + // This object has value semantics, thus, forward copy // to wrappee VCLObject( const Wrappee& rOrig ) : @@ -104,14 +110,20 @@ namespace canvas return *this; } + VCLObject& operator=( VCLObject&& rhs ) + { + std::swap(mpWrappee, rhs.mpWrappee); + + return *this; + } + ~VCLObject() { // This here is the whole purpose of the template: // protecting object deletion with the solar mutex SolarMutexGuard aGuard; - if( mpWrappee ) - delete mpWrappee; + delete mpWrappee; } Wrappee* operator->() { return mpWrappee; } |