[Libreoffice-commits] core.git: 2 commits - sw/source

Noel Grandin noel.grandin at collabora.co.uk
Tue Jul 3 06:17:25 UTC 2018


 sw/source/core/inc/layact.hxx    |    2 +-
 sw/source/core/layout/layact.cxx |    8 +++-----
 sw/source/core/text/porfld.cxx   |    4 ++--
 sw/source/core/text/porfld.hxx   |    2 +-
 4 files changed, 7 insertions(+), 9 deletions(-)

New commits:
commit 1c588317c6e55ede11c577ea16e1af85eee4810a
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date:   Mon Jul 2 14:36:54 2018 +0200

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

diff --git a/sw/source/core/text/porfld.cxx b/sw/source/core/text/porfld.cxx
index 9b76c0f5a7a0..20b18918a5aa 100644
--- a/sw/source/core/text/porfld.cxx
+++ b/sw/source/core/text/porfld.cxx
@@ -800,7 +800,7 @@ SwGrfNumPortion::~SwGrfNumPortion()
         if (pGraph)
             pGraph->StopAnimation( nullptr, nId );
     }
-    delete pBrush;
+    pBrush.reset();
 }
 
 void SwGrfNumPortion::StopAnimation( OutputDevice* pOut )
@@ -993,7 +993,7 @@ void SwGrfNumPortion::Paint( const SwTextPaintInfo &rInf ) const
 
     if( bDraw && aTmp.HasArea() )
     {
-        DrawGraphic( pBrush, const_cast<OutputDevice*>(rInf.GetOut()),
+        DrawGraphic( pBrush.get(), const_cast<OutputDevice*>(rInf.GetOut()),
             aTmp, aRepaint, m_bReplace ? GRFNUM_REPLACE : GRFNUM_YES );
     }
 }
diff --git a/sw/source/core/text/porfld.hxx b/sw/source/core/text/porfld.hxx
index 28acae3141cd..a0476bbb58f2 100644
--- a/sw/source/core/text/porfld.hxx
+++ b/sw/source/core/text/porfld.hxx
@@ -154,7 +154,7 @@ public:
 
 class SwGrfNumPortion : public SwNumberPortion
 {
-    SvxBrushItem* pBrush;
+    std::unique_ptr<SvxBrushItem> pBrush;
     long            nId;    // For StopAnimation
     SwTwips         nYPos;  // _Always_ contains the current RelPos
     SwTwips         nGrfHeight;
commit ecf56400b31511ebb737ba6c9200d1b075867ec7
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date:   Mon Jul 2 11:13:15 2018 +0200

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

diff --git a/sw/source/core/inc/layact.hxx b/sw/source/core/inc/layact.hxx
index 9240ef9d2a98..adb79928ce5d 100644
--- a/sw/source/core/inc/layact.hxx
+++ b/sw/source/core/inc/layact.hxx
@@ -60,7 +60,7 @@ class SwLayAction
     // painting.
     const SwTabFrame *m_pOptTab;
 
-    SwWait *m_pWait;
+    std::unique_ptr<SwWait> m_pWait;
 
     // If a paragraph (or anything else) moved more than one page when
     // formatting, it adds its new page number here.
diff --git a/sw/source/core/layout/layact.cxx b/sw/source/core/layout/layact.cxx
index 761a85c51741..b390ab771371 100644
--- a/sw/source/core/layout/layact.cxx
+++ b/sw/source/core/layout/layact.cxx
@@ -78,7 +78,7 @@ void SwLayAction::CheckWaitCursor()
     if ( !m_pWait && IsWaitAllowed() && IsPaint() &&
          ((std::clock() - m_nStartTicks) * 1000 / CLOCKS_PER_SEC >= CLOCKS_PER_SEC/2) )
     {
-        m_pWait = new SwWait( *m_pRoot->GetFormat()->GetDoc()->GetDocShell(), true );
+        m_pWait.reset( new SwWait( *m_pRoot->GetFormat()->GetDoc()->GetDocShell(), true ) );
     }
 }
 
@@ -319,8 +319,7 @@ void SwLayAction::Action(OutputDevice* pRenderContext)
     //TurboMode? Hands-off during idle-format
     if ( IsPaint() && !IsIdle() && TurboAction() )
     {
-        delete m_pWait;
-        m_pWait = nullptr;
+        m_pWait.reset();
         m_pRoot->ResetTurboFlag();
         m_bActionInProgress = false;
         m_pRoot->DeleteEmptySct();
@@ -348,8 +347,7 @@ void SwLayAction::Action(OutputDevice* pRenderContext)
     }
     m_pRoot->DeleteEmptySct();
 
-    delete m_pWait;
-    m_pWait = nullptr;
+    m_pWait.reset();
 
     //Turbo-Action permitted again for all cases.
     m_pRoot->ResetTurboFlag();


More information about the Libreoffice-commits mailing list