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

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Wed Jan 9 12:15:07 UTC 2019


 sc/inc/viewopti.hxx              |    2 +-
 sc/source/core/tool/viewopti.cxx |    4 ++--
 sc/source/ui/app/scmod.cxx       |    4 ++--
 3 files changed, 5 insertions(+), 5 deletions(-)

New commits:
commit bf64b723878d793980a025e624119bc5c39268d6
Author:     Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Wed Jan 9 12:00:37 2019 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Wed Jan 9 13:14:45 2019 +0100

    use unique_ptr in ScViewOptions::CreateGridItem
    
    Change-Id: I350e606b14a5a7f269fecca1d176f40c4343c344
    Reviewed-on: https://gerrit.libreoffice.org/66005
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/sc/inc/viewopti.hxx b/sc/inc/viewopti.hxx
index a0660acdf4b2..e768b1ba4a8a 100644
--- a/sc/inc/viewopti.hxx
+++ b/sc/inc/viewopti.hxx
@@ -94,7 +94,7 @@ public:
 
     const ScGridOptions&    GetGridOptions() const                      { return aGridOpt; }
     void                    SetGridOptions( const ScGridOptions& rNew ) { aGridOpt = rNew; }
-    SvxGridItem*            CreateGridItem() const;
+    std::unique_ptr<SvxGridItem> CreateGridItem() const;
 
     ScViewOptions&          operator=  ( const ScViewOptions& rCpy );
     bool                    operator== ( const ScViewOptions& rOpt ) const;
diff --git a/sc/source/core/tool/viewopti.cxx b/sc/source/core/tool/viewopti.cxx
index d3662d744650..58262ae65ba8 100644
--- a/sc/source/core/tool/viewopti.cxx
+++ b/sc/source/core/tool/viewopti.cxx
@@ -156,9 +156,9 @@ bool ScViewOptions::operator==( const ScViewOptions& rOpt ) const
     return bEqual;
 }
 
-SvxGridItem* ScViewOptions::CreateGridItem() const
+std::unique_ptr<SvxGridItem> ScViewOptions::CreateGridItem() const
 {
-    SvxGridItem* pItem = new SvxGridItem( SID_ATTR_GRID_OPTIONS );
+    std::unique_ptr<SvxGridItem> pItem(new SvxGridItem( SID_ATTR_GRID_OPTIONS ));
 
     pItem->SetFieldDrawX      ( aGridOpt.GetFieldDrawX() );
     pItem->SetFieldDivisionX  ( aGridOpt.GetFieldDivisionX() );
diff --git a/sc/source/ui/app/scmod.cxx b/sc/source/ui/app/scmod.cxx
index 632f61e4dda9..d7804043b22c 100644
--- a/sc/source/ui/app/scmod.cxx
+++ b/sc/source/ui/app/scmod.cxx
@@ -1965,9 +1965,9 @@ std::unique_ptr<SfxItemSet> ScModule::CreateItemSet( sal_uInt16 nId )
         pRet->Put( ScTpPrintItem( GetPrintOptions() ) );
 
         // TP_GRID
-        SvxGridItem* pSvxGridItem = aViewOpt.CreateGridItem();
+        std::unique_ptr<SvxGridItem> pSvxGridItem = aViewOpt.CreateGridItem();
         pRet->Put( *pSvxGridItem );
-        delete pSvxGridItem;
+        pSvxGridItem.reset();
 
         // TP_USERLISTS
         if ( pUL )


More information about the Libreoffice-commits mailing list