summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--animations/source/animcore/animcore.cxx13
-rw-r--r--svx/inc/svx/svdobj.hxx2
-rw-r--r--svx/source/svdraw/svdobj.cxx5
3 files changed, 13 insertions, 7 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 );
diff --git a/svx/inc/svx/svdobj.hxx b/svx/inc/svx/svdobj.hxx
index 75cc0e482a45..27a4568ed40e 100644
--- a/svx/inc/svx/svdobj.hxx
+++ b/svx/inc/svx/svdobj.hxx
@@ -1072,7 +1072,7 @@ protected:
private:
/** only for internal use!
*/
- SvxShape* getSvxShape() const;
+ SvxShape* getSvxShape();
/** do not use directly, always use getSvxShape() if you have to! */
SvxShape* mpSvxShape;
diff --git a/svx/source/svdraw/svdobj.cxx b/svx/source/svdraw/svdobj.cxx
index e35c9940fc0b..1e52b4f77a06 100644
--- a/svx/source/svdraw/svdobj.cxx
+++ b/svx/source/svdraw/svdobj.cxx
@@ -2963,7 +2963,7 @@ void SdrObject::impl_setUnoShape( const uno::Reference< uno::XInterface >& _rxUn
}
/** only for internal use! */
-SvxShape* SdrObject::getSvxShape() const
+SvxShape* SdrObject::getSvxShape()
{
DBG_TESTSOLARMUTEX();
// retrieving the impl pointer and subsequently using it is not thread-safe, of course, so it needs to be
@@ -2974,6 +2974,9 @@ SvxShape* SdrObject::getSvxShape() const
OSL_ENSURE( !( !xShape.is() && mpSvxShape ),
"SdrObject::getSvxShape: still having IMPL-Pointer to dead object!" );
#endif
+ //#113608#, make sure mpSvxShape is always synchronized with maWeakUnoShape
+ if ( mpSvxShape && !xShape.is() )
+ mpSvxShape = NULL;
return mpSvxShape;
}