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

Cédric Bosdonnat cbosdo at kemper.freedesktop.org
Tue Aug 16 05:46:37 PDT 2011


 svx/inc/svx/svdorect.hxx       |    5 +++--
 svx/source/svdraw/svdocirc.cxx |    2 +-
 svx/source/svdraw/svdorect.cxx |   35 ++++++++++++++++++++++++++++++-----
 3 files changed, 34 insertions(+), 8 deletions(-)

New commits:
commit c3852d41a419331277d0b98b02792f0bbf704d5b
Author: Cédric Bosdonnat <cedric.bosdonnat.ooo at free.fr>
Date:   Tue Aug 16 12:07:05 2011 +0200

    fdo#37403: Adding proper assignment operator to SdrRectObj

diff --git a/svx/inc/svx/svdorect.hxx b/svx/inc/svx/svdorect.hxx
index 2e9f938..cb99a3d 100644
--- a/svx/inc/svx/svdorect.hxx
+++ b/svx/inc/svx/svdorect.hxx
@@ -81,6 +81,8 @@ public:
     SdrRectObj();
     SdrRectObj(const Rectangle& rRect);
 
+    SdrRectObj& operator=(const SdrRectObj& rCopy);
+
     // Konstruktion eines Textrahmens
     SdrRectObj(SdrObjKind eNewTextKind);
     SdrRectObj(SdrObjKind eNewTextKind, const Rectangle& rRect);
diff --git a/svx/source/svdraw/svdorect.cxx b/svx/source/svdraw/svdorect.cxx
index 0681574..7896229 100644
--- a/svx/source/svdraw/svdorect.cxx
+++ b/svx/source/svdraw/svdorect.cxx
@@ -117,6 +117,19 @@ SdrRectObj::~SdrRectObj()
     }
 }
 
+SdrRectObj& SdrRectObj::operator=(const SdrRectObj& rCopy)
+{
+    if ( this == &rCopy )
+        return *this;
+
+    SdrTextObj::operator=( rCopy );
+
+    if ( rCopy.mpXPoly )
+        mpXPoly = new XPolygon( *rCopy.mpXPoly );
+
+    return *this;
+}
+
 void SdrRectObj::SetXPolyDirty()
 {
     if(mpXPoly)
commit 5ea5c5a53815a8157adc19f5aedbfddab02dc6c2
Author: Cédric Bosdonnat <cedric.bosdonnat.ooo at free.fr>
Date:   Tue Aug 16 12:04:51 2011 +0200

    Revert "fdo#37403: Fixed crasher by using boost::shared_ptr"
    
    This reverts commit b564df24d1ffa1e8962771ba63a3d1cf3c7bd99d. Using
    shared_ptr wasn't the ideal solution.
    
    Conflicts:
    
    	svx/source/svdraw/svdorect.cxx

diff --git a/svx/inc/svx/svdorect.hxx b/svx/inc/svx/svdorect.hxx
index 156655a..2e9f938 100644
--- a/svx/inc/svx/svdorect.hxx
+++ b/svx/inc/svx/svdorect.hxx
@@ -31,7 +31,6 @@
 
 #include <svx/svdotext.hxx>
 #include "svx/svxdllapi.h"
-#include <boost/shared_ptr.hpp>
 
 //************************************************************
 //   Vorausdeklarationen
@@ -61,7 +60,7 @@ protected:
     virtual sdr::contact::ViewContact* CreateObjectSpecificViewContact();
     virtual sdr::properties::BaseProperties* CreateObjectSpecificProperties();
 
-    ::boost::shared_ptr< XPolygon >                 mpXPoly;
+    XPolygon*                   mpXPoly;
 
 protected:
     XPolygon ImpCalcXPoly(const Rectangle& rRect1, long nRad1) const;
diff --git a/svx/source/svdraw/svdocirc.cxx b/svx/source/svdraw/svdocirc.cxx
index b8ab004..d07197e 100644
--- a/svx/source/svdraw/svdocirc.cxx
+++ b/svx/source/svdraw/svdocirc.cxx
@@ -290,7 +290,7 @@ basegfx::B2DPolygon SdrCircObj::ImpCalcXPolyCirc(const SdrObjKind eCicrleKind, c
 void SdrCircObj::RecalcXPoly()
 {
     const basegfx::B2DPolygon aPolyCirc(ImpCalcXPolyCirc(meCircleKind, aRect, nStartWink, nEndWink));
-    mpXPoly.reset( new XPolygon(aPolyCirc) );
+    mpXPoly = new XPolygon(aPolyCirc);
 }
 
 void SdrCircObj::TakeObjNameSingul(XubString& rName) const
diff --git a/svx/source/svdraw/svdorect.cxx b/svx/source/svdraw/svdorect.cxx
index 9108eda..0681574 100644
--- a/svx/source/svdraw/svdorect.cxx
+++ b/svx/source/svdraw/svdorect.cxx
@@ -77,18 +77,21 @@ sdr::contact::ViewContact* SdrRectObj::CreateObjectSpecificViewContact()
 TYPEINIT1(SdrRectObj,SdrTextObj);
 
 SdrRectObj::SdrRectObj()
+:   mpXPoly(0L)
 {
     bClosedObj=sal_True;
 }
 
 SdrRectObj::SdrRectObj(const Rectangle& rRect)
-:   SdrTextObj(rRect)
+:   SdrTextObj(rRect),
+    mpXPoly(NULL)
 {
     bClosedObj=sal_True;
 }
 
 SdrRectObj::SdrRectObj(SdrObjKind eNewTextKind)
-:   SdrTextObj(eNewTextKind)
+:   SdrTextObj(eNewTextKind),
+    mpXPoly(NULL)
 {
     DBG_ASSERT(eTextKind==OBJ_TEXT || eTextKind==OBJ_TEXTEXT ||
                eTextKind==OBJ_OUTLINETEXT || eTextKind==OBJ_TITLETEXT,
@@ -97,7 +100,8 @@ SdrRectObj::SdrRectObj(SdrObjKind eNewTextKind)
 }
 
 SdrRectObj::SdrRectObj(SdrObjKind eNewTextKind, const Rectangle& rRect)
-:   SdrTextObj(eNewTextKind,rRect)
+:   SdrTextObj(eNewTextKind,rRect),
+    mpXPoly(NULL)
 {
     DBG_ASSERT(eTextKind==OBJ_TEXT || eTextKind==OBJ_TEXTEXT ||
                eTextKind==OBJ_OUTLINETEXT || eTextKind==OBJ_TITLETEXT,
@@ -107,11 +111,19 @@ SdrRectObj::SdrRectObj(SdrObjKind eNewTextKind, const Rectangle& rRect)
 
 SdrRectObj::~SdrRectObj()
 {
+    if(mpXPoly)
+    {
+        delete mpXPoly;
+    }
 }
 
 void SdrRectObj::SetXPolyDirty()
 {
-    mpXPoly.reset();
+    if(mpXPoly)
+    {
+        delete mpXPoly;
+        mpXPoly = 0L;
+    }
 }
 
 XPolygon SdrRectObj::ImpCalcXPoly(const Rectangle& rRect1, long nRad1) const
@@ -140,7 +152,7 @@ XPolygon SdrRectObj::ImpCalcXPoly(const Rectangle& rRect1, long nRad1) const
 
 void SdrRectObj::RecalcXPoly()
 {
-    mpXPoly.reset( new XPolygon(ImpCalcXPoly(aRect,GetEckenradius())) );
+    mpXPoly = new XPolygon(ImpCalcXPoly(aRect,GetEckenradius()));
 }
 
 const XPolygon& SdrRectObj::GetXPoly() const


More information about the Libreoffice-commits mailing list