[Libreoffice-commits] core.git: include/svx svx/source

Noel Grandin noel.grandin at collabora.co.uk
Wed Feb 7 09:00:45 UTC 2018


 include/svx/textchainflow.hxx       |    5 +++--
 svx/source/svdraw/textchainflow.cxx |   12 ++++++------
 2 files changed, 9 insertions(+), 8 deletions(-)

New commits:
commit d4e1802c620e3cddb2e7a9f6a573a5a4770bc7a4
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date:   Mon Feb 5 11:25:59 2018 +0200

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

diff --git a/include/svx/textchainflow.hxx b/include/svx/textchainflow.hxx
index d52e26a86e3d..2c5f5d8c00a5 100644
--- a/include/svx/textchainflow.hxx
+++ b/include/svx/textchainflow.hxx
@@ -21,6 +21,7 @@
 #define INCLUDED_SVX_TEXTCHAINFLOW_HXX
 
 #include <svx/textchain.hxx>
+#include <memory>
 
 class SdrTextObj;
 class SdrOutliner;
@@ -56,8 +57,8 @@ protected:
     ESelection maOverflowPosSel;
     ESelection maPostChainingSel;
 
-    OFlowChainedText *mpOverflChText;
-    UFlowChainedText *mpUnderflChText;
+    std::unique_ptr<OFlowChainedText> mpOverflChText;
+    std::unique_ptr<UFlowChainedText> mpUnderflChText;
 
     void impCheckForFlowEvents(SdrOutliner *, SdrOutliner *);
 
diff --git a/svx/source/svdraw/textchainflow.cxx b/svx/source/svdraw/textchainflow.cxx
index b87d2a7f02ed..5cce8877e098 100644
--- a/svx/source/svdraw/textchainflow.cxx
+++ b/svx/source/svdraw/textchainflow.cxx
@@ -46,8 +46,8 @@ TextChainFlow::TextChainFlow(SdrTextObj *pChainTarget)
 
 TextChainFlow::~TextChainFlow()
 {
-    delete mpOverflChText;
-    delete mpUnderflChText;
+    mpOverflChText.reset();
+    mpUnderflChText.reset();
 }
 
 void TextChainFlow::impSetFlowOutlinerParams(SdrOutliner *, SdrOutliner *)
@@ -91,14 +91,14 @@ void TextChainFlow::impCheckForFlowEvents(SdrOutliner *pFlowOutl, SdrOutliner *p
     // If we had an underflow before we have to deep merge paras anyway
     bool bMustMergeParaOF = bMustMergeParaAmongLinks || mbOFisUFinduced;
 
-    mpOverflChText = bOverflow ?
+    mpOverflChText.reset( bOverflow ?
                      new OFlowChainedText(pFlowOutl, bMustMergeParaOF) :
-                     nullptr;
+                     nullptr );
 
     // Set current underflowing text (if any)
-    mpUnderflChText = bUnderflow ?
+    mpUnderflChText.reset( bUnderflow ?
                       new UFlowChainedText(pFlowOutl, bMustMergeParaAmongLinks) :
-                      nullptr;
+                      nullptr );
 
     // Reset update mode // Reset it here because we use WriteRTF (needing updatemode = true) in the two constructors above
     if (!bOldUpdateMode) // Reset only if the old value was false


More information about the Libreoffice-commits mailing list