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

Mike Kaganski (via logerrit) logerrit at kemper.freedesktop.org
Thu Sep 2 15:20:56 UTC 2021


 connectivity/source/drivers/firebird/Connection.cxx |    6 +-----
 sc/qa/extras/htmlexporttest.cxx                     |    3 +--
 sw/qa/extras/mailmerge/mailmerge.cxx                |    2 +-
 sw/qa/extras/uiwriter/uiwriter4.cxx                 |    3 +--
 4 files changed, 4 insertions(+), 10 deletions(-)

New commits:
commit 846fcc03b89a7131f565de95396757c8e0da1dfd
Author:     Mike Kaganski <mike.kaganski at collabora.com>
AuthorDate: Thu Sep 2 10:45:50 2021 +0200
Commit:     Mike Kaganski <mike.kaganski at collabora.com>
CommitDate: Thu Sep 2 17:20:20 2021 +0200

    Use utl::TempFile::EnableKillingFile
    
    Helps keep temp directory clean also on exceptions
    
    Change-Id: I81c17d90d6905653db946e68faf2a7f59c17da15
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/121466
    Tested-by: Jenkins
    Reviewed-by: Mike Kaganski <mike.kaganski at collabora.com>

diff --git a/connectivity/source/drivers/firebird/Connection.cxx b/connectivity/source/drivers/firebird/Connection.cxx
index 9e574b1f8cca..cc4ee39ff155 100644
--- a/connectivity/source/drivers/firebird/Connection.cxx
+++ b/connectivity/source/drivers/firebird/Connection.cxx
@@ -915,11 +915,7 @@ void Connection::disposing()
 
     cppu::WeakComponentImplHelperBase::disposing();
 
-    if (m_pDatabaseFileDir)
-    {
-        ::utl::removeTree(m_pDatabaseFileDir->GetURL());
-        m_pDatabaseFileDir.reset();
-    }
+    m_pDatabaseFileDir.reset();
 }
 
 void Connection::disposeStatements()
diff --git a/sc/qa/extras/htmlexporttest.cxx b/sc/qa/extras/htmlexporttest.cxx
index a27e3ac6d319..04c946a1bd32 100644
--- a/sc/qa/extras/htmlexporttest.cxx
+++ b/sc/qa/extras/htmlexporttest.cxx
@@ -72,6 +72,7 @@ public:
     {
         // need a temp dir, because there's an image exported too
         TempFile aTempDir(nullptr, true);
+        aTempDir.EnableKillingFile();
         OUString const url(aTempDir.GetURL());
         TempFile aTempFile(&url, false);
 
@@ -93,8 +94,6 @@ public:
         CPPUNIT_ASSERT (pDoc);
         assertXPath(pDoc, "/html/body", 1);
         assertXPath(pDoc, "/html/body/table/tr/td/img", 0);
-
-        utl::removeTree(aTempDir.GetURL());
     }
 
     CPPUNIT_TEST_SUITE(ScHTMLExportTest);
diff --git a/sw/qa/extras/mailmerge/mailmerge.cxx b/sw/qa/extras/mailmerge/mailmerge.cxx
index 98c626d07f0c..a1c71e0a0d49 100644
--- a/sw/qa/extras/mailmerge/mailmerge.cxx
+++ b/sw/qa/extras/mailmerge/mailmerge.cxx
@@ -84,6 +84,7 @@ public:
         preTest(filename);
 
         utl::TempFile aTempDir(nullptr, true);
+        aTempDir.EnableKillingFile();
         const OUString aWorkDir = aTempDir.GetURL();
         const OUString aURI( m_directories.getURLFromSrc(mpTestDocumentPath) + OUString::createFromAscii(datasource) );
         const OUString aPrefix = column ? OUString::createFromAscii( column ) : "LOMM_";
@@ -93,7 +94,6 @@ public:
         verify();
         finish();
 
-        ::utl::removeTree(aWorkDir);
         mnCurOutputType = 0;
     }
 
diff --git a/sw/qa/extras/uiwriter/uiwriter4.cxx b/sw/qa/extras/uiwriter/uiwriter4.cxx
index 154b46704510..431eafe06d23 100644
--- a/sw/qa/extras/uiwriter/uiwriter4.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter4.cxx
@@ -2657,6 +2657,7 @@ void SwUiWriterTest4::testTdf115013()
     const OUString sColumnName("Name with spaces, \"quotes\" and \\backslashes");
 
     utl::TempFile aTempDir(nullptr, true);
+    aTempDir.EnableKillingFile();
     const OUString aWorkDir = aTempDir.GetURL();
 
     //create new writer document
@@ -2701,8 +2702,6 @@ void SwUiWriterTest4::testTdf115013()
     OUString sColumn = static_cast<SwDBFieldType*>(pField->GetTyp())->GetColumnName();
     // The column name must come correct after round trip
     CPPUNIT_ASSERT_EQUAL(sColumnName, sColumn);
-
-    utl::removeTree(aWorkDir);
 }
 
 void SwUiWriterTest4::testTdf115065()


More information about the Libreoffice-commits mailing list