diff options
author | Caolán McNamara <caolanm@redhat.com> | 2018-10-22 09:32:39 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2018-10-22 12:54:08 +0200 |
commit | e5e0cc68f70d35e1849aeaf21c0ce68afd6a1f59 (patch) | |
tree | b4bce95d15819feb2c38e183c3ccdcbab76db60c /include | |
parent | fd56d5fd409c832886bf42a020322e69b6a35d9e (diff) |
pvs-studio: V794 The assignment operator should be protected
Change-Id: Ia443a0e61a091d877c8da26bf7d45bf4261f8669
Reviewed-on: https://gerrit.libreoffice.org/62166
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'include')
-rw-r--r-- | include/canvas/vclwrapper.hxx | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/include/canvas/vclwrapper.hxx b/include/canvas/vclwrapper.hxx index 77cf8b705e11..0a80cb282986 100644 --- a/include/canvas/vclwrapper.hxx +++ b/include/canvas/vclwrapper.hxx @@ -95,17 +95,19 @@ namespace canvas // assignment to wrappee VCLObject& operator=( const VCLObject& rhs ) { - if( mpWrappee ) + if (this != &rhs) { - if( rhs.mpWrappee ) - *mpWrappee = *rhs.mpWrappee; + if( mpWrappee ) + { + if( rhs.mpWrappee ) + *mpWrappee = *rhs.mpWrappee; + } + else + { + if( rhs.mpWrappee ) + mpWrappee = new Wrappee( *rhs.mpWrappee ); + } } - else - { - if( rhs.mpWrappee ) - mpWrappee = new Wrappee( *rhs.mpWrappee ); - } - return *this; } |