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

Michael Stahl mstahl at redhat.com
Wed Oct 15 09:09:58 PDT 2014


 sw/qa/core/uwriter.cxx               |    3 ++-
 sw/qa/extras/inc/swmodeltestbase.hxx |    8 +++++---
 sw/source/filter/ww8/ww8par.cxx      |    1 +
 sw/source/uibase/dbui/dbmgr.cxx      |   11 +++++------
 4 files changed, 13 insertions(+), 10 deletions(-)

New commits:
commit 53d496642170048b82ae67caae964bba8998efdf
Author: Michael Stahl <mstahl at redhat.com>
Date:   Wed Oct 15 18:00:29 2014 +0200

    sw: WW8 import: delete leaked SdrGrafObj (and temp file)
    
    The SdrObject returned from SvxMSDffManager::GetShape() is owned by the
    caller; since it's not inserted anywhere it has to be deleted.
    
    Change-Id: Iaac6467592ec4151173a586a6dc71f9bc44b44f0

diff --git a/sw/source/filter/ww8/ww8par.cxx b/sw/source/filter/ww8/ww8par.cxx
index 7b96f85..555aa16 100644
--- a/sw/source/filter/ww8/ww8par.cxx
+++ b/sw/source/filter/ww8/ww8par.cxx
@@ -4340,6 +4340,7 @@ void wwSectionManager::SetSegmentToPageDesc(const wwSection &rSection,
                 rFmt.SetFmtAttr(aSet.Get(RES_BACKGROUND));
             }
         }
+        SdrObject::Free(pObject);
     }
     wwULSpaceData aULData;
     GetPageULData(rSection, aULData);
commit 4eb856f0b42f56b1203e05fd397a424d7c74c255
Author: Michael Stahl <mstahl at redhat.com>
Date:   Wed Oct 15 13:34:17 2014 +0200

    sw: fix temp file leak in SwDocTest
    
    Change-Id: I493af417e9bf6c781638a5a2ec10c3bed32d1b8a

diff --git a/sw/qa/core/uwriter.cxx b/sw/qa/core/uwriter.cxx
index fe8dd09..8efd1b0 100644
--- a/sw/qa/core/uwriter.cxx
+++ b/sw/qa/core/uwriter.cxx
@@ -1263,8 +1263,9 @@ void SwDocTest::setUp()
 
 void SwDocTest::tearDown()
 {
+    m_pDoc = 0; // deleted by DoClose()
+    m_xDocShRef->DoClose();
     m_xDocShRef.Clear();
-    delete m_pDoc;
 
     BootstrapFixture::tearDown();
 }
commit a4c9c8b3fb50e5b0344f77b57db757ebbb679144
Author: Michael Stahl <mstahl at redhat.com>
Date:   Wed Oct 15 13:22:35 2014 +0200

    sw: simplify the temp-file leaking debug code in mail-merge
    
    Change-Id: Ib0de8cc5977a8721511e62f39bf3a86a6a76250a

diff --git a/sw/source/uibase/dbui/dbmgr.cxx b/sw/source/uibase/dbui/dbmgr.cxx
index f3f9697..a39ad54 100644
--- a/sw/source/uibase/dbui/dbmgr.cxx
+++ b/sw/source/uibase/dbui/dbmgr.cxx
@@ -779,21 +779,20 @@ static void lcl_RemoveSectionLinks( SwWrtShell& rWorkShell )
 static void lcl_SaveDoc( SfxObjectShell *xTargetDocShell,
                          const char *name, int no = 0 )
 {
-    boost::scoped_ptr< utl::TempFile > aTempFile;
     OUString sExt( ".odt" );
     OUString basename = OUString::createFromAscii( name );
     if (no > 0)
         basename += OUString::number(no) + "-";
-    aTempFile.reset( new utl::TempFile( basename, true, &sExt ) );
-    OSL_ENSURE( aTempFile.get(), "Temporary file not available" );
-    INetURLObject aTempFileURL( aTempFile->GetURL() );
+    // aTempFile is not deleted, but that seems to be intentional
+    utl::TempFile aTempFile(basename, true, &sExt);
+    INetURLObject aTempFileURL( aTempFile.GetURL() );
     SfxMedium* pDstMed = new SfxMedium(
         aTempFileURL.GetMainURL( INetURLObject::NO_DECODE ),
         STREAM_STD_READWRITE );
     if( !xTargetDocShell->DoSaveAs( *pDstMed ) )
-        SAL_WARN( "sw.mailmerge", "Error saving: " << aTempFile->GetURL() );
+        SAL_WARN( "sw.mailmerge", "Error saving: " << aTempFile.GetURL() );
     else
-        SAL_INFO( "sw.mailmerge", "Saved doc as: " << aTempFile->GetURL() );
+        SAL_INFO( "sw.mailmerge", "Saved doc as: " << aTempFile.GetURL() );
     delete pDstMed;
 }
 
commit beb45beba1529b0706a8dbe732c71b19493bcd7e
Author: Michael Stahl <mstahl at redhat.com>
Date:   Wed Oct 15 13:13:23 2014 +0200

    sw: fix massive temp dir leak in SwModelTestBase
    
    Change-Id: I92455612c41564e74570b4ee4fa4e3cdfa20f24d

diff --git a/sw/qa/extras/inc/swmodeltestbase.hxx b/sw/qa/extras/inc/swmodeltestbase.hxx
index 8048b8c..d2e2647 100644
--- a/sw/qa/extras/inc/swmodeltestbase.hxx
+++ b/sw/qa/extras/inc/swmodeltestbase.hxx
@@ -38,6 +38,7 @@
 #include <rtl/byteseq.hxx>
 #include <comphelper/processfactory.hxx>
 #include <unotools/tempfile.hxx>
+#include <unotools/localfilehelper.hxx>
 #include <unotools/mediadescriptor.hxx>
 #include <dbmgr.hxx>
 #include <unoprnms.hxx>
@@ -193,7 +194,6 @@ protected:
 
     sal_uInt32 mnStartTime;
     utl::TempFile maTempFile;
-    utl::TempFile maTempDir;
     bool mbExported; ///< Does maTempFile already contain something useful?
     sal_Int16 nCurOutputType;
 
@@ -215,7 +215,6 @@ public:
         , mpTestDocumentPath(pTestDocumentPath)
         , mpFilter(pFilter)
         , mnStartTime(0)
-        , maTempDir(NULL, true)
         , mbExported(false)
         , nCurOutputType(0)
     {
@@ -326,7 +325,8 @@ protected:
         load(mpTestDocumentPath, filename);
 
         const OUString aPrefix( "LOMM_" );
-        const OUString aWorkDir = maTempDir.GetURL();
+        utl::TempFile aTempDir(nullptr, true);
+        const OUString aWorkDir = aTempDir.GetURL();
         const OUString aURI( getURLFromSrc(mpTestDocumentPath) + OUString::createFromAscii(datasource) );
         OUString aDBName = registerDBsource( aURI, aPrefix, aWorkDir );
         initMailMergeJobAndArgs( filename, tablename, aDBName, aPrefix, aWorkDir );
@@ -334,6 +334,8 @@ protected:
         postTest(filename);
         verify();
         finish();
+
+        ::utl::removeTree(aWorkDir);
     }
 
     /**


More information about the Libreoffice-commits mailing list