From b564df24d1ffa1e8962771ba63a3d1cf3c7bd99d Mon Sep 17 00:00:00 2001 From: Cédric Bosdonnat Date: Fri, 8 Jul 2011 17:28:20 +0200 Subject: fdo#37403: Fixed crasher by using boost::shared_ptr --- svx/source/svdraw/svdocirc.cxx | 2 +- svx/source/svdraw/svdorect.cxx | 25 ++++++------------------- 2 files changed, 7 insertions(+), 20 deletions(-) (limited to 'svx/source/svdraw') diff --git a/svx/source/svdraw/svdocirc.cxx b/svx/source/svdraw/svdocirc.cxx index 98537d10816b..3ba41752417d 100644 --- a/svx/source/svdraw/svdocirc.cxx +++ b/svx/source/svdraw/svdocirc.cxx @@ -291,7 +291,7 @@ basegfx::B2DPolygon SdrCircObj::ImpCalcXPolyCirc(const SdrObjKind eCicrleKind, c void SdrCircObj::RecalcXPoly() { const basegfx::B2DPolygon aPolyCirc(ImpCalcXPolyCirc(meCircleKind, aRect, nStartWink, nEndWink)); - mpXPoly = new XPolygon(aPolyCirc); + mpXPoly.reset( new XPolygon(aPolyCirc) ); } void SdrCircObj::TakeObjNameSingul(XubString& rName) const diff --git a/svx/source/svdraw/svdorect.cxx b/svx/source/svdraw/svdorect.cxx index e6ecaee1a2bb..e34e389cf146 100644 --- a/svx/source/svdraw/svdorect.cxx +++ b/svx/source/svdraw/svdorect.cxx @@ -78,21 +78,18 @@ sdr::contact::ViewContact* SdrRectObj::CreateObjectSpecificViewContact() TYPEINIT1(SdrRectObj,SdrTextObj); SdrRectObj::SdrRectObj() -: mpXPoly(0L) { bClosedObj=sal_True; } SdrRectObj::SdrRectObj(const Rectangle& rRect) -: SdrTextObj(rRect), - mpXPoly(NULL) +: SdrTextObj(rRect) { bClosedObj=sal_True; } SdrRectObj::SdrRectObj(SdrObjKind eNewTextKind) -: SdrTextObj(eNewTextKind), - mpXPoly(NULL) +: SdrTextObj(eNewTextKind) { DBG_ASSERT(eTextKind==OBJ_TEXT || eTextKind==OBJ_TEXTEXT || eTextKind==OBJ_OUTLINETEXT || eTextKind==OBJ_TITLETEXT, @@ -101,8 +98,7 @@ SdrRectObj::SdrRectObj(SdrObjKind eNewTextKind) } SdrRectObj::SdrRectObj(SdrObjKind eNewTextKind, const Rectangle& rRect) -: SdrTextObj(eNewTextKind,rRect), - mpXPoly(NULL) +: SdrTextObj(eNewTextKind,rRect) { DBG_ASSERT(eTextKind==OBJ_TEXT || eTextKind==OBJ_TEXTEXT || eTextKind==OBJ_OUTLINETEXT || eTextKind==OBJ_TITLETEXT, @@ -111,8 +107,7 @@ SdrRectObj::SdrRectObj(SdrObjKind eNewTextKind, const Rectangle& rRect) } SdrRectObj::SdrRectObj(SdrObjKind eNewTextKind, const Rectangle& rNewRect, SvStream& rInput, const String& rBaseURL, sal_uInt16 eFormat) -: SdrTextObj(eNewTextKind,rNewRect,rInput,rBaseURL,eFormat), - mpXPoly(NULL) +: SdrTextObj(eNewTextKind,rNewRect,rInput,rBaseURL,eFormat) { DBG_ASSERT(eTextKind==OBJ_TEXT || eTextKind==OBJ_TEXTEXT || eTextKind==OBJ_OUTLINETEXT || eTextKind==OBJ_TITLETEXT, @@ -122,19 +117,11 @@ SdrRectObj::SdrRectObj(SdrObjKind eNewTextKind, const Rectangle& rNewRect, SvStr SdrRectObj::~SdrRectObj() { - if(mpXPoly) - { - delete mpXPoly; - } } void SdrRectObj::SetXPolyDirty() { - if(mpXPoly) - { - delete mpXPoly; - mpXPoly = 0L; - } + mpXPoly.reset(); } bool SdrRectObj::PaintNeedsXPoly(long nEckRad) const @@ -169,7 +156,7 @@ XPolygon SdrRectObj::ImpCalcXPoly(const Rectangle& rRect1, long nRad1) const void SdrRectObj::RecalcXPoly() { - mpXPoly = new XPolygon(ImpCalcXPoly(aRect,GetEckenradius())); + mpXPoly.reset( new XPolygon(ImpCalcXPoly(aRect,GetEckenradius())) ); } const XPolygon& SdrRectObj::GetXPoly() const -- cgit