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

Markus Mohrhard markus.mohrhard at googlemail.com
Fri Mar 11 06:37:50 UTC 2016


 sc/qa/unit/helper/qahelper.cxx |   13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

New commits:
commit fb827f2a342602f7e62dbdebb638326193315eb6
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date:   Fri Mar 11 02:58:17 2016 +0100

    fix a few memory leaks in the calc test framework
    
    Change-Id: Ic32d31913f40636e2b579d46ecf287110090772b
    Reviewed-on: https://gerrit.libreoffice.org/23139
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Markus Mohrhard <markus.mohrhard at googlemail.com>

diff --git a/sc/qa/unit/helper/qahelper.cxx b/sc/qa/unit/helper/qahelper.cxx
index c4df244..031f6bb 100644
--- a/sc/qa/unit/helper/qahelper.cxx
+++ b/sc/qa/unit/helper/qahelper.cxx
@@ -539,6 +539,7 @@ ScDocShellRef ScBootstrapFixture::load( bool bReadWrite,
     const OUString& rTypeName, SfxFilterFlags nFilterFlags, SotClipboardFormatId nClipboardID,
     sal_uIntPtr nFilterVersion, const OUString* pPassword )
 {
+    // TODO: will currently leak the pFilter instance
     SfxFilter* pFilter = new SfxFilter(
         rFilter,
         OUString(), nFilterFlags, nClipboardID, rTypeName, 0, OUString(),
@@ -631,12 +632,12 @@ ScDocShellRef ScBootstrapFixture::saveAndReload(
     SotClipboardFormatId nExportFormat = SotClipboardFormatId::NONE;
     if (nFormatType == ODS_FORMAT_TYPE)
         nExportFormat = SotClipboardFormatId::STARCHART_8;
-    SfxFilter* pExportFilter = new SfxFilter(
+    std::unique_ptr<SfxFilter> pExportFilter(new SfxFilter(
         rFilter,
         OUString(), nFormatType, nExportFormat, rTypeName, 0, OUString(),
-        rUserData, OUString("private:factory/scalc*") );
+        rUserData, OUString("private:factory/scalc*") ));
     pExportFilter->SetVersion(SOFFICE_FILEFORMAT_CURRENT);
-    aStoreMedium.SetFilter(pExportFilter);
+    aStoreMedium.SetFilter(pExportFilter.get());
     pShell->DoSaveAs( aStoreMedium );
     pShell->DoClose();
 
@@ -677,12 +678,12 @@ std::shared_ptr<utl::TempFile> ScBootstrapFixture::exportTo( ScDocShell* pShell,
     SfxFilterFlags nFormatType = aFileFormats[nFormat].nFormatType;
     if (nFormatType == ODS_FORMAT_TYPE)
         nExportFormat = SotClipboardFormatId::STARCHART_8;
-    SfxFilter* pExportFilter = new SfxFilter(
+    std::unique_ptr<SfxFilter> pExportFilter(new SfxFilter(
         aFilterName,
         OUString(), nFormatType, nExportFormat, aFilterType, 0, OUString(),
-        OUString(), OUString("private:factory/scalc*") );
+        OUString(), OUString("private:factory/scalc*") ));
     pExportFilter->SetVersion(SOFFICE_FILEFORMAT_CURRENT);
-    aStoreMedium.SetFilter(pExportFilter);
+    aStoreMedium.SetFilter(pExportFilter.get());
     pShell->DoSaveAs( aStoreMedium );
     pShell->DoClose();
 


More information about the Libreoffice-commits mailing list