sd/source/core/sdpage.cxx | 33 ++++++++++++++++++++++++++++++--- 1 file changed, 30 insertions(+), 3 deletions(-)
New commits: commit d7470bab57640a4499500e3c06ace4fb8ab9c4af Author: Caolán McNamara <caol...@redhat.com> Date: Mon Mar 20 16:41:11 2017 +0000 ofz: leaks in animation nodes there's no dispose option to deal with circular references Change-Id: I11ad081ab7c98648b7ab87e138f54add04ab07fe Reviewed-on: https://gerrit.libreoffice.org/35488 Tested-by: Jenkins <c...@libreoffice.org> Reviewed-by: Caolán McNamara <caol...@redhat.com> Tested-by: Caolán McNamara <caol...@redhat.com> diff --git a/sd/source/core/sdpage.cxx b/sd/source/core/sdpage.cxx index 740bcb2554a5..421e216cfe8c 100644 --- a/sd/source/core/sdpage.cxx +++ b/sd/source/core/sdpage.cxx @@ -50,6 +50,8 @@ #include <svx/svditer.hxx> #include <svx/svdlayer.hxx> #include <com/sun/star/animations/XAnimationNode.hpp> +#include <com/sun/star/animations/XTimeContainer.hpp> +#include <com/sun/star/container/XEnumerationAccess.hpp> #include <com/sun/star/xml/dom/XNode.hpp> #include <com/sun/star/xml/dom/XNodeList.hpp> #include <com/sun/star/xml/dom/XNamedNodeMap.hpp> @@ -137,6 +139,33 @@ SdPage::SdPage(SdDrawDocument& rNewDoc, bool bMasterPage) } } +namespace +{ + void clearChildNodes(css::uno::Reference<css::animations::XAnimationNode>& rAnimationNode) + { + css::uno::Reference<css::container::XEnumerationAccess > xEnumerationAccess(rAnimationNode, UNO_QUERY); + if (!xEnumerationAccess.is()) + return; + css::uno::Reference<css::container::XEnumeration> xEnumeration(xEnumerationAccess->createEnumeration(), UNO_QUERY); + if (!xEnumeration.is()) + return; + while (xEnumeration->hasMoreElements()) + { + css::uno::Reference<css::animations::XAnimationNode> xChildNode(xEnumeration->nextElement(), UNO_QUERY); + if (!xChildNode.is()) + continue; + clearChildNodes(xChildNode); + css::uno::Reference<css::animations::XTimeContainer> xAnimationNode(rAnimationNode, UNO_QUERY); + if (!xAnimationNode.is()) + { + SAL_WARN("sd.core", "can't remove node child, possible leak"); + continue; + } + xAnimationNode->removeChild(xChildNode); + } + } +} + /************************************************************************* |* |* Dtor @@ -149,9 +178,7 @@ SdPage::~SdPage() EndListenOutlineText(); - fprintf(stderr, "on dtor %p, have %p\n", this, mxAnimationNode.get()); - - mxAnimationNode.clear(); + clearChildNodes(mxAnimationNode); delete mpItems;
_______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits