diff options
author | Jian Fang Zhang <zhangjf@apache.org> | 2012-06-18 12:26:30 +0000 |
---|---|---|
committer | Eike Rathke <erack@redhat.com> | 2013-03-14 14:35:41 +0100 |
commit | d6e752d5ebfaf66d1c9b0694f9c8582311d6151a (patch) | |
tree | 7c415ddf3e38ab62a1a4a38bc415b6782963fdaa /animations/source | |
parent | b6e60d3eb5c21a98dfa86fde0bb695986058f463 (diff) |
i#113608#, memory leak in animations: newly exposed crashed problem
Patch by: zhangjf
Review by: Andre Fischer
Conflicts:
animations/source/animcore/animcore.cxx
svx/source/svdraw/svdobj.cxx
Change-Id: I305d5d92d064265edf108a5a34c948c610b4fdc1
Diffstat (limited to 'animations/source')
-rw-r--r-- | animations/source/animcore/animcore.cxx | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/animations/source/animcore/animcore.cxx b/animations/source/animcore/animcore.cxx index 6307f30d4168..a503097f07d5 100644 --- a/animations/source/animcore/animcore.cxx +++ b/animations/source/animcore/animcore.cxx @@ -46,6 +46,8 @@ #include <com/sun/star/lang/XUnoTunnel.hpp> #include <comphelper/servicehelper.hxx> #include <cppuhelper/interfacecontainer.hxx> +#include <cppuhelper/weakref.hxx> + #include <cppuhelper/implbase1.hxx> #include <rtl/uuid.h> @@ -64,6 +66,7 @@ using ::com::sun::star::uno::XInterface; using ::com::sun::star::uno::RuntimeException; using ::com::sun::star::uno::Sequence; using ::com::sun::star::uno::Reference; +using ::com::sun::star::uno::WeakReference; using ::com::sun::star::uno::XComponentContext; using ::com::sun::star::uno::Exception; using ::com::sun::star::uno::XWeak; @@ -300,7 +303,7 @@ private: Sequence< NamedValue > maUserData; // parent interface for XChild interface implementation - Reference<XInterface> mxParent; + WeakReference<XInterface> mxParent; AnimationNode* mpParent; // attributes for XAnimate @@ -1134,7 +1137,7 @@ void SAL_CALL AnimationNode::setUserData( const Sequence< NamedValue >& _userdat Reference< XInterface > SAL_CALL AnimationNode::getParent() throw (RuntimeException) { Guard< Mutex > aGuard( maMutex ); - return mxParent; + return mxParent.get(); } // -------------------------------------------------------------------- @@ -1143,12 +1146,12 @@ Reference< XInterface > SAL_CALL AnimationNode::getParent() throw (RuntimeExcept void SAL_CALL AnimationNode::setParent( const Reference< XInterface >& Parent ) throw (NoSupportException, RuntimeException) { Guard< Mutex > aGuard( maMutex ); - if( Parent != mxParent ) + if( Parent != mxParent.get() ) { mxParent = Parent; mpParent = 0; - Reference< XUnoTunnel > xTunnel( mxParent, UNO_QUERY ); + Reference< XUnoTunnel > xTunnel( mxParent.get(), UNO_QUERY ); if( xTunnel.is() ) mpParent = reinterpret_cast< AnimationNode* >( sal::static_int_cast< sal_IntPtr >(xTunnel->getSomething( getUnoTunnelId() ))); @@ -2050,7 +2053,7 @@ void AnimationNode::fireChangeListener() { Reference< XInterface > xSource( static_cast<OWeakObject*>(this), UNO_QUERY ); Sequence< ElementChange > aChanges; - const ChangesEvent aEvent( xSource, makeAny( mxParent ), aChanges ); + const ChangesEvent aEvent( xSource, makeAny( mxParent.get() ), aChanges ); while( aIterator.hasMoreElements() ) { Reference< XChangesListener > xListener( aIterator.next(), UNO_QUERY ); |