summaryrefslogtreecommitdiff
path: root/include/canvas
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2018-10-22 09:32:39 +0100
committerCaolán McNamara <caolanm@redhat.com>2018-10-22 12:54:08 +0200
commite5e0cc68f70d35e1849aeaf21c0ce68afd6a1f59 (patch)
treeb4bce95d15819feb2c38e183c3ccdcbab76db60c /include/canvas
parentfd56d5fd409c832886bf42a020322e69b6a35d9e (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/canvas')
-rw-r--r--include/canvas/vclwrapper.hxx20
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;
}