diff options
Diffstat (limited to 'svgio/source/svgreader/svgdocumenthandler.cxx')
-rw-r--r-- | svgio/source/svgreader/svgdocumenthandler.cxx | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/svgio/source/svgreader/svgdocumenthandler.cxx b/svgio/source/svgreader/svgdocumenthandler.cxx index 60fab9e84e45..8288a40be6ce 100644 --- a/svgio/source/svgreader/svgdocumenthandler.cxx +++ b/svgio/source/svgreader/svgdocumenthandler.cxx @@ -144,10 +144,16 @@ namespace svgio SvgDocHdl::~SvgDocHdl() { - if(mpTarget) + if (mpTarget) { OSL_ENSURE(false, "SvgDocHdl destructed with active target (!)"); - delete mpTarget; + + while (mpTarget->getParent()) + mpTarget = const_cast< SvgNode* >(mpTarget->getParent()); + + const SvgNodeVector& rOwnedTopLevels = maDocument.getSvgNodeVector(); + if (std::find(rOwnedTopLevels.begin(), rOwnedTopLevels.end(), mpTarget) == rOwnedTopLevels.end()) + delete mpTarget; } OSL_ENSURE(!maCssContents.size(), "SvgDocHdl destructed with active css style stack entry (!)"); } |