[Libreoffice-commits] core.git: include/svx svx/source
Noel Grandin
noel.grandin at collabora.co.uk
Tue Feb 6 11:28:49 UTC 2018
include/svx/svdotext.hxx | 5 +++--
svx/source/svdraw/svdotext.cxx | 10 +++++-----
2 files changed, 8 insertions(+), 7 deletions(-)
New commits:
commit e1f479af4ddde90f9e80b5079ac759cb9f7743a1
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date: Mon Feb 5 10:38:17 2018 +0200
loplugin:useuniqueptr in SdrTextObj
Change-Id: I48f52056dcf17a568266be49f7422fa05be974db
Reviewed-on: https://gerrit.libreoffice.org/49274
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>
diff --git a/include/svx/svdotext.hxx b/include/svx/svdotext.hxx
index ad18a2512e0b..4f862638ce8b 100644
--- a/include/svx/svdotext.hxx
+++ b/include/svx/svdotext.hxx
@@ -28,11 +28,12 @@
#include <svl/style.hxx>
#include <svx/xtextit0.hxx>
#include <svx/svdtext.hxx>
-#include <vector>
#include <svx/svxdllapi.h>
#include <drawinglayer/primitive2d/baseprimitive2d.hxx>
#include <svx/svdpagv.hxx>
#include <rtl/ref.hxx>
+#include <memory>
+#include <vector>
// forward declarations
@@ -185,7 +186,7 @@ protected:
GeoStat aGeo;
// this is the active text
- SdrText* mpText;
+ std::unique_ptr<SdrText> mpText;
// This contains the dimensions of the text
Size aTextSize;
diff --git a/svx/source/svdraw/svdotext.cxx b/svx/source/svdraw/svdotext.cxx
index 0dd6abe5788a..a0cf962a7671 100644
--- a/svx/source/svdraw/svdotext.cxx
+++ b/svx/source/svdraw/svdotext.cxx
@@ -178,7 +178,7 @@ SdrTextObj::~SdrTextObj()
rOutl.SetTextObj( nullptr );
}
- delete mpText;
+ mpText.reset();
ImpDeregisterLink();
}
@@ -2113,7 +2113,7 @@ SdrText* SdrTextObj::getActiveText() const
if( !mpText )
return getText( 0 );
else
- return mpText;
+ return mpText.get();
}
/** returns the nth available text. */
@@ -2121,9 +2121,9 @@ SdrText* SdrTextObj::getText( sal_Int32 nIndex ) const
{
if( nIndex == 0 )
{
- if( mpText == nullptr )
- const_cast< SdrTextObj* >(this)->mpText = new SdrText( *const_cast< SdrTextObj* >(this) );
- return mpText;
+ if( !mpText )
+ const_cast< SdrTextObj* >(this)->mpText.reset( new SdrText( *const_cast< SdrTextObj* >(this) ) );
+ return mpText.get();
}
else
{
More information about the Libreoffice-commits
mailing list