[Libreoffice-commits] core.git: cui/source

Noel Grandin noel.grandin at collabora.co.uk
Mon Jan 16 08:56:18 UTC 2017


 cui/source/customize/cfg.cxx    |    8 +++-----
 cui/source/inc/cfg.hxx          |    2 +-
 cui/source/options/optasian.cxx |   10 ++++------
 3 files changed, 8 insertions(+), 12 deletions(-)

New commits:
commit 4883355c31dff1f3d89f0d99d76837e0b72131d3
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date:   Mon Jan 16 09:30:41 2017 +0200

    new loplugin: useuniqueptr: cui
    
    Change-Id: I9a72b0d3ca999e2f84c615515fafa90bc7f8f2b6
    Reviewed-on: https://gerrit.libreoffice.org/33150
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/cui/source/customize/cfg.cxx b/cui/source/customize/cfg.cxx
index 56b9fa5..695a51c 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 7ddd3ac..d41568e 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 c9c99ec..4e9dfbe 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 );
     }
 }
 


More information about the Libreoffice-commits mailing list