Kaydet (Commit) 3b7472b2 authored tarafından Tomaž Vajngerl's avatar Tomaž Vajngerl

fdo#74743 avoid infinite loop when gathering "svg" element styles

Change-Id: Ifcfd0c64302b9174510e3d774607f5ca60173885
üst cae4370b
...@@ -205,17 +205,15 @@ namespace svgio ...@@ -205,17 +205,15 @@ namespace svgio
const SvgStyleAttributes* SvgStyleAttributes::getParentStyle() const const SvgStyleAttributes* SvgStyleAttributes::getParentStyle() const
{ {
if(getCssStyleParent()) const SvgStyleAttributes* pParentStyle = getCssStyleParent();
{
return getCssStyleParent();
}
if(mrOwner.getParent()) // no parent style set, check parent for its style attributes
{ if(pParentStyle == NULL && mrOwner.getParent() != NULL)
return mrOwner.getParent()->getSvgStyleAttributes(); pParentStyle = mrOwner.getParent()->getSvgStyleAttributes();
}
return 0; if (pParentStyle != this) // to prevent infinite loop
return pParentStyle;
return NULL;
} }
void SvgStyleAttributes::add_text( void SvgStyleAttributes::add_text(
......
...@@ -60,7 +60,8 @@ namespace svgio ...@@ -60,7 +60,8 @@ namespace svgio
const SvgStyleAttributes* SvgSvgNode::getSvgStyleAttributes() const const SvgStyleAttributes* SvgSvgNode::getSvgStyleAttributes() const
{ {
return checkForCssStyle(OUString("svg"), maSvgStyleAttributes); checkForCssStyle(OUString("svg"), maSvgStyleAttributes);
return maSvgStyleAttributes.getCssStyleParent();
} }
void SvgSvgNode::parseAttribute(const OUString& rTokenName, SVGToken aSVGToken, const OUString& aContent) void SvgSvgNode::parseAttribute(const OUString& rTokenName, SVGToken aSVGToken, const OUString& aContent)
......
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