diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-05-12 15:32:36 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-05-15 08:45:17 +0200 |
commit | 5e7583fe864c4491c5a19d2896b6555448146ad8 (patch) | |
tree | d7b34190055d5d2348346cdeaf139f5318ba5e78 /sw | |
parent | 4582acb3eeb2af0411ab8598ec17d74381225acf (diff) |
loplugin:useuniqueptr
ignore SAL_LOG type stuff in the destructor
Change-Id: If014382ca0c96edd3f2b325a28451d83b3d1f278
Reviewed-on: https://gerrit.libreoffice.org/37539
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sw')
-rw-r--r-- | sw/source/core/inc/laycache.hxx | 7 | ||||
-rw-r--r-- | sw/source/core/layout/laycache.cxx | 11 |
2 files changed, 9 insertions, 9 deletions
diff --git a/sw/source/core/inc/laycache.hxx b/sw/source/core/inc/laycache.hxx index 53dd324d4dac..38f464794615 100644 --- a/sw/source/core/inc/laycache.hxx +++ b/sw/source/core/inc/laycache.hxx @@ -21,6 +21,7 @@ #define INCLUDED_SW_SOURCE_CORE_INC_LAYCACHE_HXX #include <tools/solar.h> +#include <memory> class SwDoc; class SwLayCacheImpl; @@ -39,11 +40,11 @@ class SvStream; */ class SwLayoutCache { - SwLayCacheImpl *pImpl; + std::unique_ptr<SwLayCacheImpl> pImpl; sal_uInt16 nLockCount; public: - SwLayoutCache() : pImpl( nullptr ), nLockCount( 0 ) {} + SwLayoutCache(); ~SwLayoutCache(); void Read( SvStream &rStream ); @@ -56,7 +57,7 @@ public: { if( nLockCount & 0x8000 ) return nullptr; if ( pImpl ) ++nLockCount; - return pImpl; } + return pImpl.get(); } void UnlockImpl() { --nLockCount; } #ifdef DBG_UTIL diff --git a/sw/source/core/layout/laycache.cxx b/sw/source/core/layout/laycache.cxx index 251651fdbbe4..ab8f0e361841 100644 --- a/sw/source/core/layout/laycache.cxx +++ b/sw/source/core/layout/laycache.cxx @@ -47,6 +47,8 @@ using namespace ::com::sun::star; +SwLayoutCache::SwLayoutCache() : nLockCount( 0 ) {} + /* * Reading and writing of the layout cache. * The layout cache is not necessary, but it improves @@ -62,11 +64,10 @@ void SwLayoutCache::Read( SvStream &rStream ) { if( !pImpl ) { - pImpl = new SwLayCacheImpl; + pImpl.reset( new SwLayCacheImpl ); if( !pImpl->Read( rStream ) ) { - delete pImpl; - pImpl = nullptr; + pImpl.reset(); } } } @@ -429,15 +430,13 @@ void SwLayoutCache::ClearImpl() { if( !IsLocked() ) { - delete pImpl; - pImpl = nullptr; + pImpl.reset(); } } SwLayoutCache::~SwLayoutCache() { OSL_ENSURE( !nLockCount, "Deleting a locked SwLayoutCache!?" ); - delete pImpl; } /// helper class to create not nested section frames for nested sections. |