Kaydet (Commit) e1f479af authored tarafından Noel Grandin's avatar Noel Grandin

loplugin:useuniqueptr in SdrTextObj

Change-Id: I48f52056dcf17a568266be49f7422fa05be974db
Reviewed-on: https://gerrit.libreoffice.org/49274Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarNoel Grandin <noel.grandin@collabora.co.uk>
üst 7bf0b997
......@@ -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;
......
......@@ -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
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment