[Libreoffice-commits] core.git: vcl/CppunitTest_vcl_graphic_test.mk vcl/CppunitTest_vcl_type_serializer_test.mk vcl/qa vcl/source

Noel Grandin (via logerrit) logerrit at kemper.freedesktop.org
Mon May 11 11:35:45 UTC 2020


 vcl/CppunitTest_vcl_graphic_test.mk         |    6 ++++++
 vcl/CppunitTest_vcl_type_serializer_test.mk |    6 ++++++
 vcl/qa/cppunit/FontFeatureTest.cxx          |    2 ++
 vcl/qa/cppunit/GraphicTest.cxx              |   17 +++++++++++++++++
 vcl/qa/cppunit/TypeSerializerTest.cxx       |   17 +++++++++++++++++
 vcl/qa/cppunit/lifecycle.cxx                |    2 ++
 vcl/qa/cppunit/pdfexport/pdfexport.cxx      |    7 +++++++
 vcl/source/font/FeatureCollector.cxx        |    1 +
 8 files changed, 58 insertions(+)

New commits:
commit 687f46059cc9238d74e0687fbd9422dfdb109e1e
Author:     Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Mon May 11 11:09:50 2020 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Mon May 11 13:35:07 2020 +0200

    fix some leaks in vcl
    
    Change-Id: I9588841de6f751ad767f695dec51f660b2990b49
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/93954
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/vcl/CppunitTest_vcl_graphic_test.mk b/vcl/CppunitTest_vcl_graphic_test.mk
index 7b042f84d7da..353d054e1ba7 100644
--- a/vcl/CppunitTest_vcl_graphic_test.mk
+++ b/vcl/CppunitTest_vcl_graphic_test.mk
@@ -20,6 +20,12 @@ $(eval $(call gb_CppunitTest_use_externals,vcl_graphic_test,\
 	boost_headers \
 	glm_headers \
 ))
+ifeq ($(TLS),NSS)
+$(eval $(call gb_CppunitTest_use_externals,vcl_graphic_test,\
+       plc4 \
+       nss3 \
+))
+endif
 
 $(eval $(call gb_CppunitTest_set_include,vcl_graphic_test,\
     $$(INCLUDE) \
diff --git a/vcl/CppunitTest_vcl_type_serializer_test.mk b/vcl/CppunitTest_vcl_type_serializer_test.mk
index b2d78c34a6a1..ac668da41b01 100644
--- a/vcl/CppunitTest_vcl_type_serializer_test.mk
+++ b/vcl/CppunitTest_vcl_type_serializer_test.mk
@@ -14,6 +14,12 @@ $(eval $(call gb_CppunitTest_add_exception_objects,vcl_type_serializer_test, \
 ))
 
 $(eval $(call gb_CppunitTest_use_external,vcl_type_serializer_test,boost_headers))
+ifeq ($(TLS),NSS)
+$(eval $(call gb_CppunitTest_use_externals,vcl_type_serializer_test,\
+       plc4 \
+       nss3 \
+))
+endif
 
 $(eval $(call gb_CppunitTest_set_include,vcl_type_serializer_test,\
     $$(INCLUDE) \
diff --git a/vcl/qa/cppunit/FontFeatureTest.cxx b/vcl/qa/cppunit/FontFeatureTest.cxx
index 79ec3c158fbe..e4040f35bf39 100644
--- a/vcl/qa/cppunit/FontFeatureTest.cxx
+++ b/vcl/qa/cppunit/FontFeatureTest.cxx
@@ -120,6 +120,8 @@ void FontFeatureTest::testGetFontFeatures()
         CPPUNIT_ASSERT_EQUAL(uint32_t(2), rParameter3.getCode());
         CPPUNIT_ASSERT(!rParameter2.getDescription().isEmpty());
     }
+
+    aVDev.disposeAndClear();
 #endif // HAVE_MORE_FONTS
 }
 
diff --git a/vcl/qa/cppunit/GraphicTest.cxx b/vcl/qa/cppunit/GraphicTest.cxx
index d040f8837cd0..f40b5c1b88e7 100644
--- a/vcl/qa/cppunit/GraphicTest.cxx
+++ b/vcl/qa/cppunit/GraphicTest.cxx
@@ -7,6 +7,8 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
  */
 
+#include <sal/config.h>
+#include <config_oox.h>
 #include <cppunit/TestAssert.h>
 #include <cppunit/TestFixture.h>
 #include <cppunit/extensions/HelperMacros.h>
@@ -25,12 +27,20 @@
 
 #include <impgraph.hxx>
 
+#if USE_TLS_NSS
+#include <nss.h>
+#endif
+
 using namespace css;
 
 namespace
 {
 class GraphicTest : public CppUnit::TestFixture
 {
+public:
+    ~GraphicTest();
+
+private:
     void testUnloadedGraphic();
     void testUnloadedGraphicLoading();
     void testUnloadedGraphicWmf();
@@ -50,6 +60,13 @@ class GraphicTest : public CppUnit::TestFixture
     CPPUNIT_TEST_SUITE_END();
 };
 
+GraphicTest::~GraphicTest()
+{
+#if USE_TLS_NSS
+    NSS_Shutdown();
+#endif
+}
+
 BitmapEx createBitmap(bool alpha = false)
 {
     Bitmap aBitmap(Size(120, 100), 24);
diff --git a/vcl/qa/cppunit/TypeSerializerTest.cxx b/vcl/qa/cppunit/TypeSerializerTest.cxx
index 0193ce272142..30966700a3a3 100644
--- a/vcl/qa/cppunit/TypeSerializerTest.cxx
+++ b/vcl/qa/cppunit/TypeSerializerTest.cxx
@@ -7,6 +7,8 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
  */
 
+#include <sal/config.h>
+#include <config_oox.h>
 #include <config_features.h>
 
 #include <cppunit/TestAssert.h>
@@ -25,6 +27,10 @@
 
 #include <TypeSerializer.hxx>
 
+#if USE_TLS_NSS
+#include <nss.h>
+#endif
+
 namespace
 {
 constexpr char DATA_DIRECTORY[] = "/vcl/qa/cppunit/data/";
@@ -52,6 +58,10 @@ std::string toHexString(const std::vector<unsigned char>& a)
 
 class TypeSerializerTest : public CppUnit::TestFixture
 {
+public:
+    ~TypeSerializerTest();
+
+private:
     void testGradient();
     void testGraphic_Vector();
     void testGraphic_Bitmap_NoGfxLink();
@@ -67,6 +77,13 @@ class TypeSerializerTest : public CppUnit::TestFixture
     CPPUNIT_TEST_SUITE_END();
 };
 
+TypeSerializerTest::~TypeSerializerTest()
+{
+#if USE_TLS_NSS
+    NSS_Shutdown();
+#endif
+}
+
 void TypeSerializerTest::testGradient()
 {
     Gradient aGradient(GradientStyle::Radial, Color(0xFF, 0x00, 0x00), Color(0x00, 0xFF, 0x00));
diff --git a/vcl/qa/cppunit/lifecycle.cxx b/vcl/qa/cppunit/lifecycle.cxx
index 097852770814..e55e7da8ebaf 100644
--- a/vcl/qa/cppunit/lifecycle.cxx
+++ b/vcl/qa/cppunit/lifecycle.cxx
@@ -76,6 +76,8 @@ void LifecycleTest::testVirtualDevice()
     VclPtrInstance<VirtualDevice> pVDev3;
     VclPtrInstance<VirtualDevice> pVDev4(DeviceFormat::BITMASK);
     CPPUNIT_ASSERT(!!pVDev && !!pVDev2 && !!pVDev3 && !!pVDev4);
+    pVDev.disposeAndClear();
+    pVDev4.disposeAndClear();
 }
 
 void LifecycleTest::testMultiDispose()
diff --git a/vcl/qa/cppunit/pdfexport/pdfexport.cxx b/vcl/qa/cppunit/pdfexport/pdfexport.cxx
index a57add56a292..a171a6791292 100644
--- a/vcl/qa/cppunit/pdfexport/pdfexport.cxx
+++ b/vcl/qa/cppunit/pdfexport/pdfexport.cxx
@@ -1180,6 +1180,8 @@ void PdfExportTest::testTdf115117_1a()
         aChars[i] = FPDFText_GetUnicode(pPdfTextPage, i);
     OUString aActualText(aChars.data(), aChars.size());
     CPPUNIT_ASSERT_EQUAL(aExpectedText, aActualText);
+
+    FPDFText_ClosePage(pPdfTextPage);
 #endif
 }
 
@@ -1222,6 +1224,8 @@ void PdfExportTest::testTdf115117_2a()
         aChars[i] = FPDFText_GetUnicode(pPdfTextPage, i);
     OUString aActualText(aChars.data(), aChars.size());
     CPPUNIT_ASSERT_EQUAL(aExpectedText, aActualText);
+
+    FPDFText_ClosePage(pPdfTextPage);
 #endif
 }
 
@@ -1759,6 +1763,7 @@ void PdfExportTest::testTdf121962()
         CPPUNIT_ASSERT(sText != "** Expression is faulty **");
     }
 
+    FPDFText_ClosePage(pTextPage);
 }
 
 void PdfExportTest::testTdf115967()
@@ -1790,6 +1795,8 @@ void PdfExportTest::testTdf115967()
         sText += sChar.trim();
     }
     CPPUNIT_ASSERT_EQUAL(OUString("m=750abc"), sText);
+
+    FPDFText_ClosePage(pTextPage);
 }
 
 void PdfExportTest::testTdf121615()
diff --git a/vcl/source/font/FeatureCollector.cxx b/vcl/source/font/FeatureCollector.cxx
index 4d875608206e..e8219b07c328 100644
--- a/vcl/source/font/FeatureCollector.cxx
+++ b/vcl/source/font/FeatureCollector.cxx
@@ -77,6 +77,7 @@ bool FeatureCollector::collectGraphite()
                 nFeatureCode, sLabel, eFeatureParameterType, aParameters, sal_uInt32(nValue));
         }
     }
+    gr_featureval_destroy(pfeatureValues);
     return true;
 }
 


More information about the Libreoffice-commits mailing list