[Libreoffice-commits] core.git: sw/qa

Noel Grandin (via logerrit) logerrit at kemper.freedesktop.org
Tue Jun 1 12:43:29 UTC 2021


 sw/qa/core/filters-test.cxx  |    7 +++++++
 sw/qa/core/filters-test2.cxx |    7 +++++++
 2 files changed, 14 insertions(+)

New commits:
commit 6ab23779456df511a4e869ee4dc48584d297effd
Author:     Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Tue Jun 1 12:27:35 2021 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Tue Jun 1 14:42:51 2021 +0200

    fix leak in CppunitTest_sw_filters_test
    
    Change-Id: I4d6166f86d896a30b997f8cf9e9f30b34caefc4f
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/116530
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/sw/qa/core/filters-test.cxx b/sw/qa/core/filters-test.cxx
index c39f4e48edf5..e3dbdafdaa07 100644
--- a/sw/qa/core/filters-test.cxx
+++ b/sw/qa/core/filters-test.cxx
@@ -42,6 +42,7 @@ public:
         const OUString &rUserData, SfxFilterFlags nFilterFlags,
         SotClipboardFormatId nClipboardID, unsigned int nFilterVersion) override;
     virtual void setUp() override;
+    virtual void tearDown() override;
 
     // Ensure CVEs remain unbroken
     void testCVEs();
@@ -208,6 +209,12 @@ void SwFiltersTest::setUp()
     CPPUNIT_ASSERT_MESSAGE("no writer component!", m_xWriterComponent.is());
 }
 
+void SwFiltersTest::tearDown()
+{
+    uno::Reference<lang::XComponent>(m_xWriterComponent, uno::UNO_QUERY_THROW)->dispose();
+    m_xWriterComponent.clear();
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(SwFiltersTest);
 
 CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/sw/qa/core/filters-test2.cxx b/sw/qa/core/filters-test2.cxx
index 22fd9cfe525a..965645c3be57 100644
--- a/sw/qa/core/filters-test2.cxx
+++ b/sw/qa/core/filters-test2.cxx
@@ -38,6 +38,7 @@ public:
                       SfxFilterFlags nFilterFlags, SotClipboardFormatId nClipboardID,
                       unsigned int nFilterVersion) override;
     virtual void setUp() override;
+    virtual void tearDown() override;
 
     // Ensure CVEs remain unbroken
     void testCVEs();
@@ -136,6 +137,12 @@ void SwFiltersTest2::setUp()
     CPPUNIT_ASSERT_MESSAGE("no writer component!", m_xWriterComponent.is());
 }
 
+void SwFiltersTest2::tearDown()
+{
+    uno::Reference<lang::XComponent>(m_xWriterComponent, uno::UNO_QUERY_THROW)->dispose();
+    m_xWriterComponent.clear();
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(SwFiltersTest2);
 
 CPPUNIT_PLUGIN_IMPLEMENT();


More information about the Libreoffice-commits mailing list