summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuboš Luňák <l.lunak@suse.cz>2012-06-19 15:08:21 +0200
committerMiklos Vajna <vmiklos@suse.cz>2012-06-20 11:12:29 +0200
commit2d914ff7c6e7c628db22a1e1984c65fc75082289 (patch)
treea71279a574610b35b85b4c1898a225347e9b5070
parenta76695e1f3e0ad3a6a610ed7ffe6cd0507bde4aa (diff)
avoid a crash because of shared_ptr ownership
Change-Id: Ib12a80d9806d995d161d4ee71fa2b7e69eb944ea Signed-off-by: Eike Rathke <erack@redhat.com> Signed-off-by: Fridrich Strba <fridrich.strba@bluewin.ch> Signed-off-by: Miklos Vajna <vmiklos@suse.cz>
-rw-r--r--oox/inc/oox/vml/vmlshapecontainer.hxx2
-rw-r--r--oox/source/shape/ShapeContextHandler.cxx2
-rw-r--r--oox/source/vml/vmlshapecontainer.cxx6
3 files changed, 5 insertions, 5 deletions
diff --git a/oox/inc/oox/vml/vmlshapecontainer.hxx b/oox/inc/oox/vml/vmlshapecontainer.hxx
index 9b11c6ca5a0b..49c3980e0598 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 32342380e2f6..04edd85f4b69 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 9502e4cbdbe8..1d16a971d563 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;
}