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

Markus Mohrhard markus.mohrhard at googlemail.com
Sat Mar 12 13:07:22 UTC 2016


 sc/source/core/data/stlpool.cxx |    9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

New commits:
commit 91831f3af171673b67b095ecb70c607bbfca1300
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date:   Fri Mar 11 09:48:08 2016 +0100

    use unique_ptr instead of manual new delete
    
    Change-Id: I5cbc792818a61e787d4bdad6b605535cc16c8437
    Reviewed-on: https://gerrit.libreoffice.org/23170
    Reviewed-by: Markus Mohrhard <markus.mohrhard at googlemail.com>
    Tested-by: Markus Mohrhard <markus.mohrhard at googlemail.com>

diff --git a/sc/source/core/data/stlpool.cxx b/sc/source/core/data/stlpool.cxx
index 3493a9c2..2e859f6 100644
--- a/sc/source/core/data/stlpool.cxx
+++ b/sc/source/core/data/stlpool.cxx
@@ -224,12 +224,12 @@ void ScStyleSheetPool::CreateStandardStyles()
     SfxItemSet*     pSet            = nullptr;
     SfxItemSet*     pHFSet          = nullptr;
     SvxSetItem*     pHFSetItem      = nullptr;
-    ScEditEngineDefaulter*  pEdEngine   = new ScEditEngineDefaulter( EditEngine::CreatePool(), true );
+    std::unique_ptr<ScEditEngineDefaulter> pEdEngine(new ScEditEngineDefaulter( EditEngine::CreatePool(), true ));
     pEdEngine->SetUpdateMode( false );
     EditTextObject* pEmptyTxtObj    = pEdEngine->CreateTextObject();
     EditTextObject* pTxtObj         = nullptr;
-    ScPageHFItem*   pHeaderItem     = new ScPageHFItem( ATTR_PAGE_HEADERRIGHT );
-    ScPageHFItem*   pFooterItem     = new ScPageHFItem( ATTR_PAGE_FOOTERRIGHT );
+    std::unique_ptr<ScPageHFItem> pHeaderItem(new ScPageHFItem( ATTR_PAGE_HEADERRIGHT ));
+    std::unique_ptr<ScPageHFItem> pFooterItem(new ScPageHFItem( ATTR_PAGE_FOOTERRIGHT ));
     ScStyleSheet*   pSheet          = nullptr;
     ::editeng::SvxBorderLine    aBorderLine     ( &aColBlack, DEF_LINE_WIDTH_2 );
     SvxBoxItem      aBoxItem        ( ATTR_BORDER );
@@ -430,9 +430,6 @@ void ScStyleSheetPool::CreateStandardStyles()
     delete pTxtObj;
 
     delete pEmptyTxtObj;
-    delete pHeaderItem;
-    delete pFooterItem;
-    delete pEdEngine;
 }
 
 namespace {


More information about the Libreoffice-commits mailing list