From 5c18404e5dcba62c7415746b0872ae0b22fb0de4 Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Fri, 13 Oct 2017 14:29:29 +0100 Subject: ofz#3635: fix leak MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I8656b09db63c85104d60145e63591de916715e53 Reviewed-on: https://gerrit.libreoffice.org/43369 Reviewed-by: Caolán McNamara Tested-by: Caolán McNamara --- xmloff/source/core/xmlimp.cxx | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'xmloff') diff --git a/xmloff/source/core/xmlimp.cxx b/xmloff/source/core/xmlimp.cxx index a4635551c622..16ed180351e9 100644 --- a/xmloff/source/core/xmlimp.cxx +++ b/xmloff/source/core/xmlimp.cxx @@ -414,8 +414,18 @@ void SvXMLImport::cleanup() throw () mxModel->removeEventListener(mxEventListener); // clear context stacks first in case of parse error because the context // class dtors are full of application logic - while (!maFastContexts.empty()) { maFastContexts.pop(); } - while (!maContexts.empty()) { maContexts.pop(); } + while (!maFastContexts.empty()) + { + if (SvXMLStylesContext* pStylesContext = dynamic_cast(maFastContexts.top().get())) + pStylesContext->Clear(); + maFastContexts.pop(); + } + while (!maContexts.empty()) + { + if (SvXMLStylesContext* pStylesContext = dynamic_cast(maContexts.top().get())) + pStylesContext->Clear(); + maContexts.pop(); + } DisposingModel(); } -- cgit