summaryrefslogtreecommitdiff
path: root/include/vcl/lazydelete.hxx
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2018-08-03 15:55:58 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2018-08-06 12:40:33 +0200
commit2855fa6eef83ec670d927b46dc7f987c66d93057 (patch)
tree3778a32a82115ed8db5897bdce5a1ca3d4db2a8a /include/vcl/lazydelete.hxx
parentfc79121c95d111d519e58478b48957d2d4f8612d (diff)
loplugin:useuniqueptr in DeleteOnDeinit
Change-Id: If7428654a2577ba67aea57904d2a2b5099c4d602 Reviewed-on: https://gerrit.libreoffice.org/58568 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'include/vcl/lazydelete.hxx')
-rw-r--r--include/vcl/lazydelete.hxx8
1 files changed, 4 insertions, 4 deletions
diff --git a/include/vcl/lazydelete.hxx b/include/vcl/lazydelete.hxx
index 403b54abc193..89c88cbf4cc2 100644
--- a/include/vcl/lazydelete.hxx
+++ b/include/vcl/lazydelete.hxx
@@ -224,17 +224,17 @@ namespace vcl
template < typename T >
class DeleteOnDeinit : public DeleteOnDeinitBase
{
- T* m_pT;
- virtual void doCleanup() override { delete m_pT; m_pT = nullptr; }
+ std::unique_ptr<T> m_pT;
+ virtual void doCleanup() override { m_pT.reset(); }
public:
DeleteOnDeinit( T* i_pT ) : m_pT( i_pT ) { addDeinitContainer( this ); }
// get contents
- T* get() { return m_pT; }
+ T* get() { return m_pT.get(); }
// set contents, returning old contents
// ownership is transferred !
- T* set( T* i_pNew ) { T* pOld = m_pT; m_pT = i_pNew; return pOld; }
+ std::unique_ptr<T> set( std::unique_ptr<T> i_pNew ) { auto pOld = std::move(m_pT); m_pT = std::move(i_pNew); return pOld; }
};
/** Similar to DeleteOnDeinit, the DeleteUnoReferenceOnDeinit