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

Noel Grandin noel.grandin at collabora.co.uk
Thu Mar 15 09:49:38 UTC 2018


 sd/source/core/text/textapi.cxx |   14 +++-----------
 1 file changed, 3 insertions(+), 11 deletions(-)

New commits:
commit 8f03afa057cd5a053c1730499091188ee54e025f
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date:   Thu Mar 15 10:45:17 2018 +0200

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

diff --git a/sd/source/core/text/textapi.cxx b/sd/source/core/text/textapi.cxx
index 0e40f8504af6..e9806a66a646 100644
--- a/sd/source/core/text/textapi.cxx
+++ b/sd/source/core/text/textapi.cxx
@@ -40,21 +40,19 @@ class UndoTextAPIChanged : public SdrUndoAction
 {
 public:
     UndoTextAPIChanged( SdrModel& rModel, TextApiObject* pTextObj );
-    virtual ~UndoTextAPIChanged() override;
 
     virtual void Undo() override;
     virtual void Redo() override;
 
 protected:
-    OutlinerParaObject* mpOldText;
-    OutlinerParaObject* mpNewText;
+    std::unique_ptr<OutlinerParaObject> mpOldText;
+    std::unique_ptr<OutlinerParaObject> mpNewText;
     rtl::Reference< TextApiObject > mxTextObj;
 };
 
 UndoTextAPIChanged::UndoTextAPIChanged(SdrModel& rModel, TextApiObject* pTextObj )
 : SdrUndoAction( rModel )
 , mpOldText( pTextObj->CreateText() )
-, mpNewText( nullptr )
 , mxTextObj( pTextObj )
 {
 #if defined __clang__ && defined _MSC_VER // workaround clang-cl ABI bug PR25641
@@ -62,16 +60,10 @@ UndoTextAPIChanged::UndoTextAPIChanged(SdrModel& rModel, TextApiObject* pTextObj
 #endif
 }
 
-UndoTextAPIChanged::~UndoTextAPIChanged()
-{
-    delete mpOldText;
-    delete mpNewText;
-}
-
 void UndoTextAPIChanged::Undo()
 {
     if( !mpNewText )
-        mpNewText = mxTextObj->CreateText();
+        mpNewText.reset( mxTextObj->CreateText() );
 
     mxTextObj->SetText( *mpOldText );
 }


More information about the Libreoffice-commits mailing list