summaryrefslogtreecommitdiffstats
path: root/oox
diff options
context:
space:
mode:
authorMichael Stahl <mstahl@redhat.com>2012-03-01 22:24:04 +0100
committerMichael Stahl <mstahl@redhat.com>2012-03-03 00:05:28 +0100
commit56665a8a22d274f2f335eb38623d226760440e7e (patch)
tree06c40911f9e7ae0695a9c7c7bf326e0c3b123422 /oox
parentcustomshapes: re-generate smaller, faster to compile data. (diff)
downloadcore-56665a8a22d274f2f335eb38623d226760440e7e.tar.gz
core-56665a8a22d274f2f335eb38623d226760440e7e.zip
oox::drawingml::Shape: fix "lock underflow in SvxShape" assertions
Diffstat (limited to 'oox')
-rw-r--r--oox/source/drawingml/shape.cxx28
1 files changed, 20 insertions, 8 deletions
diff --git a/oox/source/drawingml/shape.cxx b/oox/source/drawingml/shape.cxx
index 5e3aa738577c..2b2d81500f8d 100644
--- a/oox/source/drawingml/shape.cxx
+++ b/oox/source/drawingml/shape.cxx
@@ -225,9 +225,6 @@ void Shape::addShape(
if ( xShapes.is() )
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& )
{
@@ -271,6 +268,25 @@ void Shape::addChildren( ::oox::core::XmlFilterBase& rFilterBase,
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
void Shape::addChildren(
XmlFilterBase& rFilterBase,
@@ -446,9 +462,7 @@ Reference< XShape > Shape::createAndInsert(
xSet->setPropertyValue( sVisible, Any( sal_False ) );
}
- Reference< document::XActionLockable > xLockable( mxShape, UNO_QUERY );
- if( xLockable.is() )
- xLockable->addActionLock();
+ ActionLockGuard const alg(mxShape);
// sj: removing default text of placeholder objects such as SlideNumberShape or HeaderShape
if ( bClearText )
@@ -562,8 +576,6 @@ Reference< XShape > Shape::createAndInsert(
getTextBody()->insertAt( rFilterBase, xText, xAt, aCharStyleProperties, mpMasterTextListStyle );
}
}
- if( xLockable.is() )
- xLockable->removeActionLock();
}
if( mxShape.is() )