[Libreoffice-commits] .: svx/inc svx/source

Cédric Bosdonnat cbosdo at kemper.freedesktop.org
Fri Jul 8 08:28:59 PDT 2011


 svx/inc/svx/svdorect.hxx       |    3 ++-
 svx/source/svdraw/svdocirc.cxx |    2 +-
 svx/source/svdraw/svdorect.cxx |   25 ++++++-------------------
 3 files changed, 9 insertions(+), 21 deletions(-)

New commits:
commit 21ec661d09ed9d7bbbec5e52ee2b382d8c465324
Author: Cédric Bosdonnat <cedric.bosdonnat.ooo at free.fr>
Date:   Fri Jul 8 17:28:20 2011 +0200

    fdo#37403: Fixed crasher by using boost::shared_ptr

diff --git a/svx/inc/svx/svdorect.hxx b/svx/inc/svx/svdorect.hxx
index 6114875..28593c8 100644
--- a/svx/inc/svx/svdorect.hxx
+++ b/svx/inc/svx/svdorect.hxx
@@ -31,6 +31,7 @@
 
 #include <svx/svdotext.hxx>
 #include "svx/svxdllapi.h"
+#include <boost/shared_ptr.hpp>
 
 //************************************************************
 //   Vorausdeklarationen
@@ -60,7 +61,7 @@ protected:
     virtual sdr::contact::ViewContact* CreateObjectSpecificViewContact();
     virtual sdr::properties::BaseProperties* CreateObjectSpecificProperties();
 
-    XPolygon*					mpXPoly;
+    ::boost::shared_ptr< XPolygon >					mpXPoly;
 
 protected:
     // Liefert sal_True, wenn das Painten ein Polygon erfordert.
diff --git a/svx/source/svdraw/svdocirc.cxx b/svx/source/svdraw/svdocirc.cxx
index c59c322..86cb1eb 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 3d2ddc6..24bbe48 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


More information about the Libreoffice-commits mailing list