summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2017-07-13 16:23:32 +0100
committerMichael Meeks <michael.meeks@collabora.com>2017-07-21 11:22:12 +0200
commit3825a8f2f367e0bcbb58c010167c5dfb94d46274 (patch)
tree00a8eb046b43821dec9fc9d2ee8d37c97759b8f1
parent2f75ce44545fd4b424e9257a35d6281d5ecb3b8f (diff)
Resolves: tdf#108903 avoid recurse to death
Change-Id: Iadde719a024c5fce97aa0f4c58947a5012639a84 Reviewed-on: https://gerrit.libreoffice.org/39920 Reviewed-by: Michael Stahl <mstahl@redhat.com> Tested-by: Michael Stahl <mstahl@redhat.com> (cherry picked from commit e2075593e4d13b6e7c0b32b23912fdeed1ada6bf) Reviewed-on: https://gerrit.libreoffice.org/39989 Reviewed-by: Eike Rathke <erack@redhat.com> Reviewed-by: Michael Meeks <michael.meeks@collabora.com> Tested-by: Michael Meeks <michael.meeks@collabora.com>
-rw-r--r--svgio/inc/svgusenode.hxx2
-rw-r--r--svgio/source/svgreader/svgusenode.cxx7
2 files changed, 7 insertions, 2 deletions
diff --git a/svgio/inc/svgusenode.hxx b/svgio/inc/svgusenode.hxx
index 05c0063699c5..7a438c11e960 100644
--- a/svgio/inc/svgusenode.hxx
+++ b/svgio/inc/svgusenode.hxx
@@ -45,6 +45,8 @@ namespace svgio
/// link to content. If maXLink is set, the node can be fetched
// on demand
OUString maXLink;
+ /// detect if maXLink causes a loop to ourself during decomposing
+ mutable bool mbDecomposingSvgNode;
public:
SvgUseNode(
diff --git a/svgio/source/svgreader/svgusenode.cxx b/svgio/source/svgreader/svgusenode.cxx
index 104eb727bfed..86692d91c3d7 100644
--- a/svgio/source/svgreader/svgusenode.cxx
+++ b/svgio/source/svgreader/svgusenode.cxx
@@ -35,7 +35,8 @@ namespace svgio
maY(),
maWidth(),
maHeight(),
- maXLink()
+ maXLink(),
+ mbDecomposingSvgNode(false)
{
}
@@ -142,7 +143,7 @@ namespace svgio
// try to access link to content
const SvgNode* pXLink = getDocument().findSvgNodeById(maXLink);
- if(pXLink && Display_none != pXLink->getDisplay())
+ if (pXLink && Display_none != pXLink->getDisplay() && !mbDecomposingSvgNode)
{
// decompose children
drawinglayer::primitive2d::Primitive2DContainer aNewTarget;
@@ -150,9 +151,11 @@ namespace svgio
// todo: in case mpXLink is a SVGTokenSvg or SVGTokenSymbol the
// SVG docs want the getWidth() and getHeight() from this node
// to be valid for the subtree.
+ mbDecomposingSvgNode = true;
const_cast< SvgNode* >(pXLink)->setAlternativeParent(this);
pXLink->decomposeSvgNode(aNewTarget, true);
const_cast< SvgNode* >(pXLink)->setAlternativeParent();
+ mbDecomposingSvgNode = false;
if(!aNewTarget.empty())
{