summaryrefslogtreecommitdiff
path: root/animations
diff options
context:
space:
mode:
Diffstat (limited to 'animations')
-rw-r--r--animations/source/animcore/animcore.cxx23
1 files changed, 12 insertions, 11 deletions
diff --git a/animations/source/animcore/animcore.cxx b/animations/source/animcore/animcore.cxx
index 04e7a7daa879..05b3ae010561 100644
--- a/animations/source/animcore/animcore.cxx
+++ b/animations/source/animcore/animcore.cxx
@@ -2010,22 +2010,23 @@ Reference< XAnimationNode > SAL_CALL AnimationNode::removeChild( const Reference
// XTimeContainer
Reference< XAnimationNode > SAL_CALL AnimationNode::appendChild( const Reference< XAnimationNode >& newChild )
{
- Guard< Mutex > aGuard( m_aMutex );
-
- if( !newChild.is() )
- throw IllegalArgumentException("no child", static_cast<cppu::OWeakObject*>(this), 1);
+ Reference< XInterface > xThis( static_cast< OWeakObject * >(this) );
+ {
+ Guard< Mutex > aGuard( m_aMutex );
- if( std::find(maChildren.begin(), maChildren.end(), newChild) != maChildren.end() )
- throw ElementExistException();
+ if( !newChild.is() )
+ throw IllegalArgumentException("no child", static_cast<cppu::OWeakObject*>(this), 1);
- Reference< XInterface > xThis( static_cast< OWeakObject * >(this) );
- Reference< XInterface > xChild( newChild );
+ if( std::find(maChildren.begin(), maChildren.end(), newChild) != maChildren.end() )
+ throw ElementExistException();
- if( xThis == xChild )
- throw IllegalArgumentException("cannot append self", static_cast<cppu::OWeakObject*>(this), -1);
+ Reference< XInterface > xChild( newChild );
- maChildren.push_back( newChild );
+ if( xThis == xChild )
+ throw IllegalArgumentException("cannot append self", static_cast<cppu::OWeakObject*>(this), -1);
+ maChildren.push_back( newChild );
+ }
newChild->setParent( xThis );
return newChild;