svx/source/sdr/contact/objectcontactofobjlistpainter.cxx |    7 +++----
 svx/source/sdr/contact/objectcontactofpageview.cxx       |    6 +++---
 svx/source/sdr/contact/viewcontactofe3dcube.cxx          |    7 ++-----
 svx/source/sdr/contact/viewcontactofe3dextrude.cxx       |    7 ++-----
 svx/source/sdr/contact/viewcontactofe3dlathe.cxx         |    7 ++-----
 svx/source/sdr/contact/viewcontactofe3dpolygon.cxx       |    7 ++-----
 svx/source/sdr/contact/viewcontactofe3dsphere.cxx        |    7 ++-----
 svx/source/sdr/overlay/overlaymanager.cxx                |    8 ++++----
 svx/source/sdr/primitive2d/sdrmeasureprimitive2d.cxx     |   10 +++++-----
 9 files changed, 25 insertions(+), 41 deletions(-)

New commits:
commit c60f6227f826968f1c937758130ff1d18459d553
Author: Takeshi Abe <t...@fixedpoint.jp>
Date:   Fri Jun 27 16:04:18 2014 +0900

    Avoid possible memory leaks in case of exceptions
    
    Change-Id: I1d703da6c0f9fd1a7e2423cc609fb504bb553382

diff --git a/svx/source/sdr/contact/objectcontactofobjlistpainter.cxx 
b/svx/source/sdr/contact/objectcontactofobjlistpainter.cxx
index 493ad02..eadd8a7 100644
--- a/svx/source/sdr/contact/objectcontactofobjlistpainter.cxx
+++ b/svx/source/sdr/contact/objectcontactofobjlistpainter.cxx
@@ -27,7 +27,7 @@
 #include <basegfx/matrix/b2dhommatrix.hxx>
 #include <drawinglayer/processor2d/processor2dtools.hxx>
 #include <svx/unoapi.hxx>
-
+#include <boost/scoped_ptr.hpp>
 
 
 namespace sdr
@@ -127,14 +127,13 @@ namespace sdr
                     // if there is something to show, use a vclProcessor to 
render it
                     if(xPrimitiveSequence.hasElements())
                     {
-                        drawinglayer::processor2d::BaseProcessor2D* 
pProcessor2D = drawinglayer::processor2d::createProcessor2DFromOutputDevice(
+                        
boost::scoped_ptr<drawinglayer::processor2d::BaseProcessor2D> 
pProcessor2D(drawinglayer::processor2d::createProcessor2DFromOutputDevice(
                             *pTargetDevice,
-                            getViewInformation2D());
+                            getViewInformation2D()));
 
                         if(pProcessor2D)
                         {
                             pProcessor2D->process(xPrimitiveSequence);
-                            delete pProcessor2D;
                         }
                     }
                 }
diff --git a/svx/source/sdr/contact/objectcontactofpageview.cxx 
b/svx/source/sdr/contact/objectcontactofpageview.cxx
index 864e730..dbd43d3 100644
--- a/svx/source/sdr/contact/objectcontactofpageview.cxx
+++ b/svx/source/sdr/contact/objectcontactofpageview.cxx
@@ -37,6 +37,7 @@
 #include <svx/unoapi.hxx>
 
 #include "eventhandler.hxx"
+#include <boost/scoped_ptr.hpp>
 
 using namespace com::sun::star;
 
@@ -284,14 +285,13 @@ namespace sdr
                 pOutDev->SetLayoutMode(0); // reset, default is no BiDi/RTL
 
                 // create renderer
-                drawinglayer::processor2d::BaseProcessor2D* pProcessor2D =
+                boost::scoped_ptr<drawinglayer::processor2d::BaseProcessor2D> 
pProcessor2D(
                     
drawinglayer::processor2d::createProcessor2DFromOutputDevice(
-                        rTargetOutDev, getViewInformation2D());
+                        rTargetOutDev, getViewInformation2D()));
 
                 if(pProcessor2D)
                 {
                     pProcessor2D->process(xPrimitiveSequence);
-                    delete pProcessor2D;
                 }
             }
 
diff --git a/svx/source/sdr/contact/viewcontactofe3dcube.cxx 
b/svx/source/sdr/contact/viewcontactofe3dcube.cxx
index 94c9776..c717c04 100644
--- a/svx/source/sdr/contact/viewcontactofe3dcube.cxx
+++ b/svx/source/sdr/contact/viewcontactofe3dcube.cxx
@@ -24,7 +24,7 @@
 #include <svx/sdr/primitive2d/sdrattributecreator.hxx>
 #include <sdr/primitive3d/sdrattributecreator3d.hxx>
 #include <basegfx/range/b3drange.hxx>
-
+#include <boost/scoped_ptr.hpp>
 
 
 namespace sdr
@@ -71,7 +71,7 @@ namespace sdr
             aWorldTransform.translate(aCubeRange.getMinX(), 
aCubeRange.getMinY(), aCubeRange.getMinZ());
 
             // get 3D Object Attributes
-            drawinglayer::attribute::Sdr3DObjectAttribute* 
pSdr3DObjectAttribute = 
drawinglayer::primitive2d::createNewSdr3DObjectAttribute(rItemSet);
+            boost::scoped_ptr<drawinglayer::attribute::Sdr3DObjectAttribute> 
pSdr3DObjectAttribute(drawinglayer::primitive2d::createNewSdr3DObjectAttribute(rItemSet));
 
             // calculate texture size to get a perfect mapping for
             // the front/back sides
@@ -83,9 +83,6 @@ namespace sdr
                     aWorldTransform, aTextureSize, aAttribute, 
*pSdr3DObjectAttribute));
             xRetval = 
drawinglayer::primitive3d::Primitive3DSequence(&xReference, 1);
 
-            // delete 3D Object Attributes
-            delete pSdr3DObjectAttribute;
-
             return xRetval;
         }
     } // end of namespace contact
diff --git a/svx/source/sdr/contact/viewcontactofe3dextrude.cxx 
b/svx/source/sdr/contact/viewcontactofe3dextrude.cxx
index f9110bc..cf4132e 100644
--- a/svx/source/sdr/contact/viewcontactofe3dextrude.cxx
+++ b/svx/source/sdr/contact/viewcontactofe3dextrude.cxx
@@ -24,7 +24,7 @@
 #include <svx/sdr/primitive2d/sdrattributecreator.hxx>
 #include <sdr/primitive3d/sdrattributecreator3d.hxx>
 #include <basegfx/polygon/b2dpolypolygontools.hxx>
-
+#include <boost/scoped_ptr.hpp>
 
 
 namespace sdr
@@ -51,7 +51,7 @@ namespace sdr
             const basegfx::B2DPolyPolygon 
aPolyPolygon(GetE3dExtrudeObj().GetExtrudePolygon());
 
             // get 3D Object Attributes
-            drawinglayer::attribute::Sdr3DObjectAttribute* 
pSdr3DObjectAttribute = 
drawinglayer::primitive2d::createNewSdr3DObjectAttribute(rItemSet);
+            boost::scoped_ptr<drawinglayer::attribute::Sdr3DObjectAttribute> 
pSdr3DObjectAttribute(drawinglayer::primitive2d::createNewSdr3DObjectAttribute(rItemSet));
 
             // calculate texture size; use size of top/bottom cap to get a 
perfect mapping
             // for the caps. The in-between geometry will get a stretched size 
with a
@@ -78,9 +78,6 @@ namespace sdr
                     bCharacterMode, bCloseFront, bCloseBack));
             xRetval = 
drawinglayer::primitive3d::Primitive3DSequence(&xReference, 1);
 
-            // delete 3D Object Attributes
-            delete pSdr3DObjectAttribute;
-
             return xRetval;
         }
     } // end of namespace contact
diff --git a/svx/source/sdr/contact/viewcontactofe3dlathe.cxx 
b/svx/source/sdr/contact/viewcontactofe3dlathe.cxx
index 72d290b..1f22774 100644
--- a/svx/source/sdr/contact/viewcontactofe3dlathe.cxx
+++ b/svx/source/sdr/contact/viewcontactofe3dlathe.cxx
@@ -24,7 +24,7 @@
 #include <svx/sdr/primitive2d/sdrattributecreator.hxx>
 #include <sdr/primitive3d/sdrattributecreator3d.hxx>
 #include <basegfx/polygon/b2dpolygontools.hxx>
-
+#include <boost/scoped_ptr.hpp>
 
 
 namespace sdr
@@ -51,7 +51,7 @@ namespace sdr
             const basegfx::B2DPolyPolygon 
aPolyPolygon(GetE3dLatheObj().GetPolyPoly2D());
 
             // get 3D Object Attributes
-            drawinglayer::attribute::Sdr3DObjectAttribute* 
pSdr3DObjectAttribute = 
drawinglayer::primitive2d::createNewSdr3DObjectAttribute(rItemSet);
+            boost::scoped_ptr<drawinglayer::attribute::Sdr3DObjectAttribute> 
pSdr3DObjectAttribute(drawinglayer::primitive2d::createNewSdr3DObjectAttribute(rItemSet));
 
             // calculate texture size. Use the polygon length of the longest 
polygon for
             // height and the rotated radius for width (using polygon center) 
to get a good
@@ -93,9 +93,6 @@ namespace sdr
                     bSmoothNormals, true, bSmoothLids, bCharacterMode, 
bCloseFront, bCloseBack));
             xRetval = 
drawinglayer::primitive3d::Primitive3DSequence(&xReference, 1);
 
-            // delete 3D Object Attributes
-            delete pSdr3DObjectAttribute;
-
             return xRetval;
         }
     } // end of namespace contact
diff --git a/svx/source/sdr/contact/viewcontactofe3dpolygon.cxx 
b/svx/source/sdr/contact/viewcontactofe3dpolygon.cxx
index ca24df8..9a281921 100644
--- a/svx/source/sdr/contact/viewcontactofe3dpolygon.cxx
+++ b/svx/source/sdr/contact/viewcontactofe3dpolygon.cxx
@@ -25,7 +25,7 @@
 #include <sdr/primitive3d/sdrattributecreator3d.hxx>
 #include <basegfx/polygon/b3dpolygon.hxx>
 #include <basegfx/polygon/b3dpolypolygontools.hxx>
-
+#include <boost/scoped_ptr.hpp>
 
 
 namespace sdr
@@ -99,7 +99,7 @@ namespace sdr
             }
 
             // get 3D Object Attributes
-            drawinglayer::attribute::Sdr3DObjectAttribute* 
pSdr3DObjectAttribute = 
drawinglayer::primitive2d::createNewSdr3DObjectAttribute(rItemSet);
+            boost::scoped_ptr<drawinglayer::attribute::Sdr3DObjectAttribute> 
pSdr3DObjectAttribute(drawinglayer::primitive2d::createNewSdr3DObjectAttribute(rItemSet));
 
             // calculate texture size
             basegfx::B2DVector aTextureSize(1.0, 1.0);
@@ -164,9 +164,6 @@ namespace sdr
                     aPolyPolygon3D, aWorldTransform, aTextureSize, aAttribute, 
*pSdr3DObjectAttribute));
             xRetval = 
drawinglayer::primitive3d::Primitive3DSequence(&xReference, 1);
 
-            // delete 3D Object Attributes
-            delete pSdr3DObjectAttribute;
-
             return xRetval;
         }
     } // end of namespace contact
diff --git a/svx/source/sdr/contact/viewcontactofe3dsphere.cxx 
b/svx/source/sdr/contact/viewcontactofe3dsphere.cxx
index 60fa51d..96c286b 100644
--- a/svx/source/sdr/contact/viewcontactofe3dsphere.cxx
+++ b/svx/source/sdr/contact/viewcontactofe3dsphere.cxx
@@ -23,7 +23,7 @@
 #include <drawinglayer/primitive3d/sdrsphereprimitive3d.hxx>
 #include <svx/sdr/primitive2d/sdrattributecreator.hxx>
 #include <sdr/primitive3d/sdrattributecreator3d.hxx>
-
+#include <boost/scoped_ptr.hpp>
 
 
 namespace sdr
@@ -57,7 +57,7 @@ namespace sdr
             aWorldTransform.translate(aSpherePosition.getX(), 
aSpherePosition.getY(), aSpherePosition.getZ());
 
             // get 3D Object Attributes
-            drawinglayer::attribute::Sdr3DObjectAttribute* 
pSdr3DObjectAttribute = 
drawinglayer::primitive2d::createNewSdr3DObjectAttribute(rItemSet);
+            boost::scoped_ptr<drawinglayer::attribute::Sdr3DObjectAttribute> 
pSdr3DObjectAttribute(drawinglayer::primitive2d::createNewSdr3DObjectAttribute(rItemSet));
 
             // get segment count
             const sal_uInt32 
nHorizontalSegments(GetE3dSphereObj().GetHorizontalSegments());
@@ -76,9 +76,6 @@ namespace sdr
                     nHorizontalSegments, nVerticalSegments));
             xRetval = 
drawinglayer::primitive3d::Primitive3DSequence(&xReference, 1);
 
-            // delete 3D Object Attributes
-            delete pSdr3DObjectAttribute;
-
             return xRetval;
         }
     } // end of namespace contact
diff --git a/svx/source/sdr/overlay/overlaymanager.cxx 
b/svx/source/sdr/overlay/overlaymanager.cxx
index bcd2818..e2f2b2b 100644
--- a/svx/source/sdr/overlay/overlaymanager.cxx
+++ b/svx/source/sdr/overlay/overlaymanager.cxx
@@ -26,7 +26,7 @@
 #include <svx/sdr/overlay/overlayobject.hxx>
 #include <basegfx/matrix/b2dhommatrix.hxx>
 #include <drawinglayer/processor2d/processor2dtools.hxx>
-
+#include <boost/scoped_ptr.hpp>
 
 
 using namespace com::sun::star;
@@ -47,9 +47,9 @@ namespace sdr
                 const bool 
bIsAntiAliasing(getDrawinglayerOpt().IsAntiAliasing());
 
                 // create processor
-                drawinglayer::processor2d::BaseProcessor2D* pProcessor = 
drawinglayer::processor2d::createProcessor2DFromOutputDevice(
+                boost::scoped_ptr<drawinglayer::processor2d::BaseProcessor2D> 
pProcessor(drawinglayer::processor2d::createProcessor2DFromOutputDevice(
                     rDestinationDevice,
-                    getCurrentViewInformation2D());
+                    getCurrentViewInformation2D()));
 
                 if(pProcessor)
                 {
@@ -81,7 +81,7 @@ namespace sdr
                         }
                     }
 
-                    delete pProcessor;
+                    pProcessor.reset();
                 }
 
                 // restore AA settings
diff --git a/svx/source/sdr/primitive2d/sdrmeasureprimitive2d.cxx 
b/svx/source/sdr/primitive2d/sdrmeasureprimitive2d.cxx
index ea9ae60..1c0040b 100644
--- a/svx/source/sdr/primitive2d/sdrmeasureprimitive2d.cxx
+++ b/svx/source/sdr/primitive2d/sdrmeasureprimitive2d.cxx
@@ -28,7 +28,7 @@
 #include <svx/sdr/primitive2d/svx_primitivetypes2d.hxx>
 #include <basegfx/matrix/b2dhommatrixtools.hxx>
 #include <drawinglayer/primitive2d/hiddengeometryprimitive2d.hxx>
-
+#include <boost/scoped_ptr.hpp>
 
 
 using namespace com::sun::star;
@@ -86,7 +86,7 @@ namespace drawinglayer
         Primitive2DSequence SdrMeasurePrimitive2D::create2DDecomposition(const 
geometry::ViewInformation2D& aViewInformation) const
         {
             Primitive2DSequence aRetval;
-            SdrBlockTextPrimitive2D* pBlockText = 0;
+            boost::scoped_ptr<SdrBlockTextPrimitive2D> pBlockText;
             basegfx::B2DRange aTextRange;
             double fTextX((getStart().getX() + getEnd().getX()) * 0.5);
             double fTextY((getStart().getX() + getEnd().getX()) * 0.5);
@@ -125,7 +125,7 @@ namespace drawinglayer
                 }
 
                 // create primitive and get text range
-                pBlockText = new SdrBlockTextPrimitive2D(
+                pBlockText.reset(new SdrBlockTextPrimitive2D(
                     &rTextAttribute.getSdrText(),
                     rTextAttribute.getOutlinerParaObject(),
                     aTextMatrix,
@@ -135,7 +135,7 @@ namespace drawinglayer
                     false,
                     false,
                     false,
-                    false);
+                    false));
 
                 aTextRange = pBlockText->getB2DRange(aViewInformation);
             }
@@ -421,7 +421,7 @@ namespace drawinglayer
                 // apply to existing text primitive
                 SdrTextPrimitive2D* pNewBlockText = 
pBlockText->createTransformedClone(aChange);
                 OSL_ENSURE(pNewBlockText, 
"SdrMeasurePrimitive2D::create2DDecomposition: Could not create transformed 
clone of text primitive (!)");
-                delete pBlockText;
+                pBlockText.reset();
 
                 // add to local primitives
                 appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, 
Primitive2DReference(pNewBlockText));
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to