Kaydet (Commit) 56665a8a authored tarafından Michael Stahl's avatar Michael Stahl

oox::drawingml::Shape: fix "lock underflow in SvxShape" assertions

üst 5d49bf62
...@@ -225,9 +225,6 @@ void Shape::addShape( ...@@ -225,9 +225,6 @@ void Shape::addShape(
if ( xShapes.is() ) if ( xShapes.is() )
addChildren( rFilterBase, *this, pTheme, xShapes, pShapeRect ? *pShapeRect : awt::Rectangle( maPosition.X, maPosition.Y, maSize.Width, maSize.Height ), pShapeMap, aMatrix ); addChildren( rFilterBase, *this, pTheme, xShapes, pShapeRect ? *pShapeRect : awt::Rectangle( maPosition.X, maPosition.Y, maSize.Width, maSize.Height ), pShapeMap, aMatrix );
} }
Reference< document::XActionLockable > xLockable( mxShape, UNO_QUERY );
if( xLockable.is() )
xLockable->removeActionLock();
} }
catch( const Exception& ) catch( const Exception& )
{ {
...@@ -271,6 +268,25 @@ void Shape::addChildren( ::oox::core::XmlFilterBase& rFilterBase, ...@@ -271,6 +268,25 @@ void Shape::addChildren( ::oox::core::XmlFilterBase& rFilterBase,
pShapeMap, aTransformation); pShapeMap, aTransformation);
} }
struct ActionLockGuard
{
explicit ActionLockGuard(Reference<drawing::XShape> const& xShape)
: m_xLockable(xShape, UNO_QUERY)
{
if (m_xLockable.is()) {
m_xLockable->addActionLock();
}
}
~ActionLockGuard()
{
if (m_xLockable.is()) {
m_xLockable->removeActionLock();
}
}
private:
Reference<document::XActionLockable> m_xLockable;
};
// for group shapes, the following method is also adding each child // for group shapes, the following method is also adding each child
void Shape::addChildren( void Shape::addChildren(
XmlFilterBase& rFilterBase, XmlFilterBase& rFilterBase,
...@@ -446,9 +462,7 @@ Reference< XShape > Shape::createAndInsert( ...@@ -446,9 +462,7 @@ Reference< XShape > Shape::createAndInsert(
xSet->setPropertyValue( sVisible, Any( sal_False ) ); xSet->setPropertyValue( sVisible, Any( sal_False ) );
} }
Reference< document::XActionLockable > xLockable( mxShape, UNO_QUERY ); ActionLockGuard const alg(mxShape);
if( xLockable.is() )
xLockable->addActionLock();
// sj: removing default text of placeholder objects such as SlideNumberShape or HeaderShape // sj: removing default text of placeholder objects such as SlideNumberShape or HeaderShape
if ( bClearText ) if ( bClearText )
...@@ -562,8 +576,6 @@ Reference< XShape > Shape::createAndInsert( ...@@ -562,8 +576,6 @@ Reference< XShape > Shape::createAndInsert(
getTextBody()->insertAt( rFilterBase, xText, xAt, aCharStyleProperties, mpMasterTextListStyle ); getTextBody()->insertAt( rFilterBase, xText, xAt, aCharStyleProperties, mpMasterTextListStyle );
} }
} }
if( xLockable.is() )
xLockable->removeActionLock();
} }
if( mxShape.is() ) if( mxShape.is() )
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment