[Libreoffice-commits] core.git: Branch 'libreoffice-7-1' - sd/source
Caolán McNamara (via logerrit)
logerrit at kemper.freedesktop.org
Tue Jun 22 07:37:08 UTC 2021
sd/source/ui/unoidl/randomnode.cxx | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
New commits:
commit 78ebf1dcf78456d6c45e907c201af50b1edac87f
Author: Caolán McNamara <caolanm at redhat.com>
AuthorDate: Sun Jun 13 16:41:32 2021 +0100
Commit: Xisco Fauli <xiscofauli at libreoffice.org>
CommitDate: Tue Jun 22 09:36:35 2021 +0200
ofz#34297 Indirect-leak
this is similar to the memory leak fixed by
commit d6e752d5ebfaf66d1c9b0694f9c8582311d6151a
Author: Jian Fang Zhang <zhangjf at apache.org>
Date: Mon Jun 18 12:26:30 2012 +0000
i#113608#, memory leak in animations: newly exposed crashed problem
where the parent node holds a reference to its children and the child
held a reference to its parent.
Change RandomAnimationNode to use a WeakReference to its parent like
the other AnimationNodes do
Change-Id: I251a6127c301d1fb7e51397d8f05db4020bc612c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/117115
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli at libreoffice.org>
diff --git a/sd/source/ui/unoidl/randomnode.cxx b/sd/source/ui/unoidl/randomnode.cxx
index 86c973336101..a87ae1783721 100644
--- a/sd/source/ui/unoidl/randomnode.cxx
+++ b/sd/source/ui/unoidl/randomnode.cxx
@@ -33,6 +33,7 @@
#include <cppuhelper/implbase.hxx>
#include <cppuhelper/supportsservice.hxx>
+#include <cppuhelper/weakref.hxx>
#include <osl/mutex.hxx>
#include <CustomAnimationPreset.hxx>
#include <randomnode.hxx>
@@ -45,6 +46,7 @@ using ::com::sun::star::uno::Sequence;
using ::com::sun::star::uno::Any;
using ::com::sun::star::uno::UNO_QUERY;
using ::com::sun::star::uno::XInterface;
+using ::com::sun::star::uno::WeakReference;
using ::com::sun::star::beans::NamedValue;
using ::com::sun::star::lang::IllegalArgumentException;
using ::com::sun::star::container::XEnumeration;
@@ -58,6 +60,7 @@ using ::com::sun::star::presentation::ParagraphTarget;
using ::com::sun::star::drawing::XShape;
using namespace ::com::sun::star::animations;
+
namespace sd
{
@@ -139,7 +142,7 @@ private:
Mutex maMutex;
sal_Int16 mnPresetClass;
- Reference< XInterface > mxParent;
+ WeakReference<XInterface> mxParent;
Any maBegin, maDuration, maEnd, maEndSync, maRepeatCount, maRepeatDuration, maTarget;
sal_Int16 mnFill, mnFillDefault, mnRestart, mnRestartDefault;
@@ -426,7 +429,7 @@ void SAL_CALL RandomAnimationNode::setUserData( const Sequence< NamedValue >& _u
Reference< XInterface > SAL_CALL RandomAnimationNode::getParent()
{
Guard< Mutex > aGuard( maMutex );
- return mxParent;
+ return mxParent.get();
}
// XChild
More information about the Libreoffice-commits
mailing list