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

Noel Grandin noel.grandin at collabora.co.uk
Tue Mar 13 12:26:30 UTC 2018


 sd/inc/drawdoc.hxx          |    4 ++--
 sd/source/core/drawdoc.cxx  |    6 ++----
 sd/source/core/drawdoc2.cxx |    5 ++---
 sd/source/core/drawdoc3.cxx |    4 ++--
 4 files changed, 8 insertions(+), 11 deletions(-)

New commits:
commit 2d4988070b06567ce145403294dd402ac0f996d5
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date:   Tue Mar 13 13:11:19 2018 +0200

    loplugin:useuniqueptr in SdDrawDocument
    
    Change-Id: Ia207c25b091923738811aad4f367a76e9e026283
    Reviewed-on: https://gerrit.libreoffice.org/51207
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/sd/inc/drawdoc.hxx b/sd/inc/drawdoc.hxx
index 1b6425dc795c..5ddb69a9b451 100644
--- a/sd/inc/drawdoc.hxx
+++ b/sd/inc/drawdoc.hxx
@@ -142,14 +142,14 @@ private:
                         mpOutliner;          ///< local outliner for outline mode
     std::unique_ptr<SdOutliner>
                         mpInternalOutliner;  ///< internal outliner for creation of text objects
-    Timer*              mpWorkStartupTimer;
+    std::unique_ptr<Timer> mpWorkStartupTimer;
     Idle*               mpOnlineSpellingIdle;
     sd::ShapeList*      mpOnlineSpellingList;
     std::unique_ptr<SvxSearchItem>
                         mpOnlineSearchItem;
     std::vector<std::unique_ptr<sd::FrameView>>
                         maFrameViewList;
-    SdCustomShowList*   mpCustomShowList;
+    std::unique_ptr<SdCustomShowList>   mpCustomShowList;
     ::sd::DrawDocShell* mpDocSh;
     SdTransferable *    mpCreatingTransferable;
     bool                mbHasOnlineSpellErrors;
diff --git a/sd/source/core/drawdoc.cxx b/sd/source/core/drawdoc.cxx
index d0f6506804ac..d6335e3671d3 100644
--- a/sd/source/core/drawdoc.cxx
+++ b/sd/source/core/drawdoc.cxx
@@ -351,8 +351,7 @@ SdDrawDocument::~SdDrawDocument()
         if ( mpWorkStartupTimer->IsActive() )
             mpWorkStartupTimer->Stop();
 
-        delete mpWorkStartupTimer;
-        mpWorkStartupTimer = nullptr;
+        mpWorkStartupTimer.reset();
     }
 
     StopOnlineSpelling();
@@ -386,8 +385,7 @@ SdDrawDocument::~SdDrawDocument()
             delete pCustomShow;
         }
 
-        delete mpCustomShowList;
-        mpCustomShowList = nullptr;
+        mpCustomShowList.reset();
     }
 
     mpOutliner.reset();
diff --git a/sd/source/core/drawdoc2.cxx b/sd/source/core/drawdoc2.cxx
index 3da22f3dfb3b..0652a9aa812d 100644
--- a/sd/source/core/drawdoc2.cxx
+++ b/sd/source/core/drawdoc2.cxx
@@ -681,7 +681,7 @@ void SdDrawDocument::CreateFirstPages( SdDrawDocument const * pRefDocument /* =
         if( !pRefPage && (meDocType != DocumentType::Draw) )
             pPage->SetAutoLayout( AUTOLAYOUT_TITLE, true, true );
 
-        mpWorkStartupTimer = new Timer("DrawWorkStartupTimer");
+        mpWorkStartupTimer.reset( new Timer("DrawWorkStartupTimer") );
         mpWorkStartupTimer->SetInvokeHandler( LINK(this, SdDrawDocument, WorkStartupHdl) );
         mpWorkStartupTimer->SetTimeout(2000);
         mpWorkStartupTimer->Start();
@@ -968,8 +968,7 @@ void SdDrawDocument::StopWorkStartupDelay()
             WorkStartupHdl(nullptr);
         }
 
-        delete mpWorkStartupTimer;
-        mpWorkStartupTimer = nullptr;
+        mpWorkStartupTimer.reset();
     }
 }
 
diff --git a/sd/source/core/drawdoc3.cxx b/sd/source/core/drawdoc3.cxx
index bd731f255465..5df4c3d2b930 100644
--- a/sd/source/core/drawdoc3.cxx
+++ b/sd/source/core/drawdoc3.cxx
@@ -1181,10 +1181,10 @@ SdCustomShowList* SdDrawDocument::GetCustomShowList(bool bCreate)
 {
     if (!mpCustomShowList && bCreate)
     {
-        mpCustomShowList = new SdCustomShowList;
+        mpCustomShowList.reset(new SdCustomShowList);
     }
 
-    return mpCustomShowList;
+    return mpCustomShowList.get();
 }
 
 // Remove unused master pages and layouts


More information about the Libreoffice-commits mailing list