diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-01-16 09:30:41 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-01-16 08:55:56 +0000 |
commit | 4883355c31dff1f3d89f0d99d76837e0b72131d3 (patch) | |
tree | d809b43c59045b1bd362d83dd581e55ebf409c47 /cui | |
parent | 9123ba9632ec1e8a74e215c406da9ca02be09b8d (diff) |
new loplugin: useuniqueptr: cui
Change-Id: I9a72b0d3ca999e2f84c615515fafa90bc7f8f2b6
Reviewed-on: https://gerrit.libreoffice.org/33150
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'cui')
-rw-r--r-- | cui/source/customize/cfg.cxx | 8 | ||||
-rw-r--r-- | cui/source/inc/cfg.hxx | 2 | ||||
-rw-r--r-- | cui/source/options/optasian.cxx | 10 |
3 files changed, 8 insertions, 12 deletions
diff --git a/cui/source/customize/cfg.cxx b/cui/source/customize/cfg.cxx index 56b9fa572ad5..695a51c64219 100644 --- a/cui/source/customize/cfg.cxx +++ b/cui/source/customize/cfg.cxx @@ -3685,7 +3685,6 @@ ToolbarSaveInData::ToolbarSaveInData( ToolbarSaveInData::~ToolbarSaveInData() { - delete pRootEntry; } void ToolbarSaveInData::SetSystemStyle( @@ -3885,9 +3884,9 @@ SvxEntries* ToolbarSaveInData::GetEntries() if ( pRootEntry == nullptr ) { - pRootEntry = new SvxConfigEntry( + pRootEntry.reset( new SvxConfigEntry( OUString("MainToolbars"), - OUString(), true); + OUString(), true) ); uno::Sequence< uno::Sequence < beans::PropertyValue > > info = GetConfigManager()->getUIElementsInfo( @@ -4121,8 +4120,7 @@ void ToolbarSaveInData::Reset() // now delete the root SvxConfigEntry the next call to GetEntries() // causes it to be reinitialised - delete pRootEntry; - pRootEntry = nullptr; + pRootEntry.reset(); // reset all icons to default try diff --git a/cui/source/inc/cfg.hxx b/cui/source/inc/cfg.hxx index 7ddd3ac79162..d41568e4aa4c 100644 --- a/cui/source/inc/cfg.hxx +++ b/cui/source/inc/cfg.hxx @@ -618,7 +618,7 @@ class ToolbarSaveInData : public SaveInData { private: - SvxConfigEntry* pRootEntry; + std::unique_ptr<SvxConfigEntry> pRootEntry; OUString m_aDescriptorContainer; css::uno::Reference diff --git a/cui/source/options/optasian.cxx b/cui/source/options/optasian.cxx index c9c99ecb6830..4e9dfbe161eb 100644 --- a/cui/source/options/optasian.cxx +++ b/cui/source/options/optasian.cxx @@ -50,13 +50,12 @@ struct SvxForbiddenChars_Impl { ~SvxForbiddenChars_Impl(); - bool bRemoved; - ForbiddenCharacters* pCharacters; + bool bRemoved; + std::unique_ptr<ForbiddenCharacters> pCharacters; }; SvxForbiddenChars_Impl::~SvxForbiddenChars_Impl() { - delete pCharacters; } typedef ::std::map< LanguageType, SvxForbiddenChars_Impl* > SvxForbiddenCharacterMap_Impl; @@ -109,14 +108,13 @@ void SvxAsianLayoutPage_Impl::addForbiddenCharacters( { SvxForbiddenChars_Impl* pChar = new SvxForbiddenChars_Impl; pChar->bRemoved = nullptr == pForbidden; - pChar->pCharacters = pForbidden ? new ForbiddenCharacters(*pForbidden) : nullptr; + pChar->pCharacters.reset( pForbidden ? new ForbiddenCharacters(*pForbidden) : nullptr ); aChangedLanguagesMap.insert( ::std::make_pair( eLang, pChar ) ); } else { itOld->second->bRemoved = nullptr == pForbidden; - delete itOld->second->pCharacters; - itOld->second->pCharacters = pForbidden ? new ForbiddenCharacters(*pForbidden) : nullptr; + itOld->second->pCharacters.reset( pForbidden ? new ForbiddenCharacters(*pForbidden) : nullptr ); } } |