[Libreoffice-commits] core.git: include/xmloff xmloff/source

Noel Grandin (via logerrit) logerrit at kemper.freedesktop.org
Mon Aug 3 11:52:37 UTC 2020


 include/xmloff/txtimp.hxx     |    2 ++
 xmloff/source/core/xmlimp.cxx |    2 ++
 xmloff/source/text/txtimp.cxx |    6 ++++++
 3 files changed, 10 insertions(+)

New commits:
commit 22fda7524385225d9264e48ee3f4811674f8239c
Author:     Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Mon Aug 3 10:31:42 2020 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Mon Aug 3 13:51:55 2020 +0200

    fix leak in SvXMLImport
    
    caused by a ref-counting cycle.
    
    to reproduce the leak do
    
      make CppunitTest_editeng_core \
        VALGRIND='memcheck --leak-check=full \
    --suppressions=$$BUILDDIR/solenv/sanitizers/valgrind-suppressions' \
        CPPUNIT_TEST_NAME="testBoldItalicCopyPaste"
    
    Change-Id: I94dca092a75db8ddfaae4a210e1158fa066ed609
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99989
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/include/xmloff/txtimp.hxx b/include/xmloff/txtimp.hxx
index 96edbbee0dba..4258c4b73bfb 100644
--- a/include/xmloff/txtimp.hxx
+++ b/include/xmloff/txtimp.hxx
@@ -398,6 +398,8 @@ public:
 
     virtual ~XMLTextImportHelper() override;
 
+    void dispose();
+
     void SetCursor(
             const css::uno::Reference< css::text::XTextCursor >& rCursor );
     void ResetCursor();
diff --git a/xmloff/source/core/xmlimp.cxx b/xmloff/source/core/xmlimp.cxx
index 9aca2c429b90..e305e69bff5b 100644
--- a/xmloff/source/core/xmlimp.cxx
+++ b/xmloff/source/core/xmlimp.cxx
@@ -442,6 +442,8 @@ void SvXMLImport::cleanup() throw ()
             pStylesContext->Clear();
         maContexts.pop();
     }
+    if( mxTextImport )
+        mxTextImport->dispose();
     mxTextImport.clear(); // XMLRedlineImportHelper needs model
     DisposingModel();
 }
diff --git a/xmloff/source/text/txtimp.cxx b/xmloff/source/text/txtimp.cxx
index d047942752e3..961cda1bfac7 100644
--- a/xmloff/source/text/txtimp.cxx
+++ b/xmloff/source/text/txtimp.cxx
@@ -1048,6 +1048,12 @@ XMLTextImportHelper::~XMLTextImportHelper()
 {
 }
 
+void XMLTextImportHelper::dispose()
+{
+    if (m_xImpl->m_xAutoStyles)
+        static_cast<SvXMLStylesContext *>(m_xImpl->m_xAutoStyles.get())->Clear();
+}
+
 SvXMLImportPropertyMapper *XMLTextImportHelper::CreateShapeExtPropMapper(SvXMLImport& rImport)
 {
     XMLPropertySetMapper *pPropMapper =


More information about the Libreoffice-commits mailing list