Kaydet (Commit) 304b16c3 authored tarafından Caolán McNamara's avatar Caolán McNamara

Resolves: tdf#108903 avoid recurse to death

Change-Id: Iadde719a024c5fce97aa0f4c58947a5012639a84
Reviewed-on: https://gerrit.libreoffice.org/39918Reviewed-by: 's avatarCaolán McNamara <caolanm@redhat.com>
Tested-by: 's avatarCaolán McNamara <caolanm@redhat.com>
üst d15d3d92
......@@ -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(
......
......@@ -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 = true;
if(!aNewTarget.empty())
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment