diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-12-13 15:47:02 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-12-13 20:08:35 +0100 |
commit | 78a6ce17f06fbe13b806fd563e85a4fe60d3bcfc (patch) | |
tree | 25e6d39e9f4d9bc3ffd703f752a35128f70de7b7 /unotools | |
parent | 3f7fbae1bc38d528080552a715af187285f47028 (diff) |
DELETEZ->std::unique_ptr in toolkit,unotools
Change-Id: I2263e233ae03575e53ab4e7894a7507423afd32e
Reviewed-on: https://gerrit.libreoffice.org/46397
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'unotools')
-rw-r--r-- | unotools/source/config/saveopt.cxx | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/unotools/source/config/saveopt.cxx b/unotools/source/config/saveopt.cxx index cdb66c6fabe4..35b721702f21 100644 --- a/unotools/source/config/saveopt.cxx +++ b/unotools/source/config/saveopt.cxx @@ -45,11 +45,11 @@ class SvtLoadOptions_Impl; struct SvtLoadSaveOptions_Impl { - SvtSaveOptions_Impl* pSaveOpt; - SvtLoadOptions_Impl* pLoadOpt; + std::unique_ptr<SvtSaveOptions_Impl> pSaveOpt; + std::unique_ptr<SvtLoadOptions_Impl> pLoadOpt; }; -static SvtLoadSaveOptions_Impl* pOptions = nullptr; +static std::unique_ptr<SvtLoadSaveOptions_Impl> pOptions; static sal_Int32 nRefCount = 0; class SvtSaveOptions_Impl : public utl::ConfigItem @@ -802,14 +802,14 @@ SvtSaveOptions::SvtSaveOptions() ::osl::MutexGuard aGuard( LocalSingleton::get() ); if ( !pOptions ) { - pOptions = new SvtLoadSaveOptions_Impl; - pOptions->pSaveOpt = new SvtSaveOptions_Impl; - pOptions->pLoadOpt = new SvtLoadOptions_Impl; + pOptions.reset(new SvtLoadSaveOptions_Impl); + pOptions->pSaveOpt.reset(new SvtSaveOptions_Impl); + pOptions->pLoadOpt.reset( new SvtLoadOptions_Impl); ItemHolder1::holdConfigItem(EItem::SaveOptions); } ++nRefCount; - pImp = pOptions; + pImp = pOptions.get(); } SvtSaveOptions::~SvtSaveOptions() @@ -823,9 +823,7 @@ SvtSaveOptions::~SvtSaveOptions() if ( pOptions->pLoadOpt->IsModified() ) pOptions->pLoadOpt->Commit(); - DELETEZ( pOptions->pLoadOpt ); - DELETEZ( pOptions->pSaveOpt ); - DELETEZ( pOptions ); + pOptions.reset(); } } |