[Libreoffice-commits] .: Branch 'libreoffice-3-5' - oox/inc oox/source

Eike Rathke erack at kemper.freedesktop.org
Tue Jun 19 13:17:31 PDT 2012


 oox/inc/oox/vml/vmlshapecontainer.hxx    |    2 +-
 oox/source/shape/ShapeContextHandler.cxx |    2 +-
 oox/source/vml/vmlshapecontainer.cxx     |    6 +++---
 3 files changed, 5 insertions(+), 5 deletions(-)

New commits:
commit 78ef70018013f4f02fdecaac8dbf2ab51ad247d2
Author: Luboš Luňák <l.lunak at suse.cz>
Date:   Tue Jun 19 15:08:21 2012 +0200

    avoid a crash because of shared_ptr ownership
    
    Change-Id: Ib12a80d9806d995d161d4ee71fa2b7e69eb944ea
    
    Signed-off-by: Eike Rathke <erack at redhat.com>

diff --git a/oox/inc/oox/vml/vmlshapecontainer.hxx b/oox/inc/oox/vml/vmlshapecontainer.hxx
index 9b11c6c..49c3980 100644
--- a/oox/inc/oox/vml/vmlshapecontainer.hxx
+++ b/oox/inc/oox/vml/vmlshapecontainer.hxx
@@ -93,7 +93,7 @@ public:
     const ShapeBase*    findShape( const Functor& rFunctor ) const;
 
     /** Returns and removes the last shape in the collection (Word only). */
-    const ShapeBase*    takeLastShape();
+    boost::shared_ptr< ShapeBase > takeLastShape();
 
     /** Creates and inserts all UNO shapes into the passed container. */
     void                convertAndInsert(
diff --git a/oox/source/shape/ShapeContextHandler.cxx b/oox/source/shape/ShapeContextHandler.cxx
index 3234238..04edd85 100644
--- a/oox/source/shape/ShapeContextHandler.cxx
+++ b/oox/source/shape/ShapeContextHandler.cxx
@@ -244,7 +244,7 @@ ShapeContextHandler::getShape() throw (uno::RuntimeException)
         if ( getContextHandler() == getDrawingShapeContext() )
         {
             mpDrawing->finalizeFragmentImport();
-            if( const ::oox::vml::ShapeBase* pShape = mpDrawing->getShapes().takeLastShape() )
+            if( boost::shared_ptr< ::oox::vml::ShapeBase > pShape = mpDrawing->getShapes().takeLastShape() )
                 xResult = pShape->convertAndInsert( xShapes );
         }
         else if (mpShape.get() != NULL)
diff --git a/oox/source/vml/vmlshapecontainer.cxx b/oox/source/vml/vmlshapecontainer.cxx
index 9502e4c..1d16a97 100644
--- a/oox/source/vml/vmlshapecontainer.cxx
+++ b/oox/source/vml/vmlshapecontainer.cxx
@@ -118,12 +118,12 @@ const ShapeBase* ShapeContainer::getShapeById( const OUString& rShapeId, bool bD
    return 0;
 }
 
-const ShapeBase* ShapeContainer::takeLastShape()
+boost::shared_ptr< ShapeBase > ShapeContainer::takeLastShape()
 {
     assert( mrDrawing.getType() == VMLDRAWING_WORD );
     if( maShapes.empty())
-        return NULL;
-    const ShapeBase* ret = maShapes.back().get();
+        return boost::shared_ptr< ShapeBase >();
+    boost::shared_ptr< ShapeBase > ret = maShapes.back();
     maShapes.pop_back();
     return ret;
 }


More information about the Libreoffice-commits mailing list