diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-08-03 15:57:10 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-08-06 08:49:22 +0200 |
commit | 96b36edb8963706560a55a5e93a471e39ebd846f (patch) | |
tree | dbd1a44d1995b580e5e5094f3f0db812fc7dc008 /include/canvas | |
parent | fa0f81614f456ed61a73dd3c8b7d1a534badfff5 (diff) |
loplugin:useuniqueptr in VCLObject
Change-Id: Ib31e3ea5c4ac59ff526e85b6156a06130ad20311
Reviewed-on: https://gerrit.libreoffice.org/58572
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'include/canvas')
-rw-r--r-- | include/canvas/vclwrapper.hxx | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/include/canvas/vclwrapper.hxx b/include/canvas/vclwrapper.hxx index e35cb5fa13b9..77cf8b705e11 100644 --- a/include/canvas/vclwrapper.hxx +++ b/include/canvas/vclwrapper.hxx @@ -63,7 +63,7 @@ namespace canvas // no explicit here. VCLObjects should be freely // constructible with Wrappees, and AFAIK there is no other // implicit conversion path that could cause harm here - VCLObject( Wrappee* pWrappee ) : + VCLObject( std::unique_ptr<Wrappee> pWrappee ) : mpWrappee( pWrappee ) { } @@ -122,11 +122,11 @@ namespace canvas // protecting object deletion with the solar mutex SolarMutexGuard aGuard; - delete mpWrappee; + mpWrappee.reset(); } - Wrappee* operator->() { return mpWrappee; } - const Wrappee* operator->() const { return mpWrappee; } + Wrappee* operator->() { return mpWrappee.get(); } + const Wrappee* operator->() const { return mpWrappee.get(); } Wrappee& operator*() { return *mpWrappee; } const Wrappee& operator*() const { return *mpWrappee; } @@ -141,7 +141,7 @@ namespace canvas private: - Wrappee* mpWrappee; + std::unique_ptr<Wrappee> mpWrappee; }; } |