ofz#60384 Direct-leak

since:

commit 13a41e7a12
Date:   Mon Jul 3 14:11:43 2023 +0200

    tdf#150124: do nothing when parent is of unkown type

Change-Id: I58edf5f63d97e8afb1cd58c7e23452a9ea6a87eb
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154023
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
This commit is contained in:
Caolán McNamara 2023-07-05 09:31:58 +01:00
parent 451f15888a
commit 0dfd8288a8
2 changed files with 12 additions and 3 deletions

View file

@ -34,6 +34,9 @@ namespace svgio::svgreader
/// the document hierarchy with all root nodes
SvgNodeVector maNodes;
/// invalid nodes that have no parent
SvgNodeVector maOrphanNodes;
/// the absolute path of the Svg file in progress (if available)
const OUString maAbsolutePath;
@ -72,6 +75,9 @@ namespace svgio::svgreader
/// data read access
const SvgNodeVector& getSvgNodeVector() const { return maNodes; }
const OUString& getAbsolutePath() const { return maAbsolutePath; }
/// invalid nodes that have no parent
void addOrphanNode(SvgNode* pOrphan) { maOrphanNodes.emplace_back(pOrphan); }
};
} // end of namespace svgio::svgreader

View file

@ -395,10 +395,13 @@ namespace {
mbDecomposing(false),
mbCssStyleVectorBuilt(false)
{
// tdf#150124 ignore when parent is unknown
if(pParent && pParent->getType() != SVGToken::Unknown)
if (pParent)
{
pParent->maChildren.emplace_back(this);
// tdf#150124 ignore when parent is unknown
if (pParent->getType() != SVGToken::Unknown)
pParent->maChildren.emplace_back(this);
else
mrDocument.addOrphanNode(this);
}
}