summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/svx/svdotext.hxx5
-rw-r--r--svx/source/svdraw/svdotext.cxx10
2 files changed, 8 insertions, 7 deletions
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
{