diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-01-15 16:15:48 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-01-17 10:16:35 +0200 |
commit | cf52cc9a0b1c8d46c9beb1d3583a77090a72314d (patch) | |
tree | dfdaf75109c57eaee1cf24c62ca576365ff10dc7 | |
parent | d72a2899dfd849056c6562bcd08537e1ab52100c (diff) |
loplugin:useuniqueptr in AsynchronLink
Change-Id: I911bb1f8ca98e368f8275083936a8eb9013f462c
-rw-r--r-- | include/svtools/asynclink.hxx | 5 | ||||
-rw-r--r-- | svtools/source/control/asynclink.cxx | 6 |
2 files changed, 6 insertions, 5 deletions
diff --git a/include/svtools/asynclink.hxx b/include/svtools/asynclink.hxx index d037504b0464..c229b25f3d1c 100644 --- a/include/svtools/asynclink.hxx +++ b/include/svtools/asynclink.hxx @@ -24,6 +24,7 @@ #include <tools/solar.h> #include <tools/link.hxx> #include <osl/mutex.hxx> +#include <memory> class Idle; class Timer; @@ -35,11 +36,11 @@ class SVT_DLLPUBLIC AsynchronLink { Link<void*,void> _aLink; ImplSVEvent* _nEventId; - Idle* _pIdle; + std::unique_ptr<Idle> _pIdle; bool _bInCall; bool* _pDeleted; void* _pArg; - ::osl::Mutex* _pMutex; + std::unique_ptr<::osl::Mutex> _pMutex; DECL_DLLPRIVATE_LINK( HandleCall_Idle, Timer*, void ); DECL_DLLPRIVATE_LINK( HandleCall_PostUserEvent, void*, void ); diff --git a/svtools/source/control/asynclink.cxx b/svtools/source/control/asynclink.cxx index 16bccb92a2b6..5778b291ef86 100644 --- a/svtools/source/control/asynclink.cxx +++ b/svtools/source/control/asynclink.cxx @@ -30,7 +30,7 @@ namespace svtools { void AsynchronLink::CreateMutex() { - if( !_pMutex ) _pMutex = new osl::Mutex; + if( !_pMutex ) _pMutex.reset( new osl::Mutex ); } void AsynchronLink::Call( void* pObj, bool bAllowDoubles ) @@ -55,9 +55,9 @@ AsynchronLink::~AsynchronLink() { Application::RemoveUserEvent( _nEventId ); } - delete _pIdle; + _pIdle.reset(); if( _pDeleted ) *_pDeleted = true; - delete _pMutex; + _pMutex.reset(); } IMPL_LINK_NOARG( AsynchronLink, HandleCall_Idle, Timer*, void ) |