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

Stephan Bergmann sbergman at redhat.com
Thu Dec 29 22:33:17 UTC 2016


 sw/qa/extras/uiwriter/uiwriter.cxx |   14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)

New commits:
commit 4323d81598db774050ffc45bfa96803f747b5729
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Thu Dec 29 23:32:49 2016 +0100

    Close XConnection when done
    
    Change-Id: Icea70da002f88752603ad21482975d1707d29520

diff --git a/sw/qa/extras/uiwriter/uiwriter.cxx b/sw/qa/extras/uiwriter/uiwriter.cxx
index 1f4c032..5ac5648 100644
--- a/sw/qa/extras/uiwriter/uiwriter.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter.cxx
@@ -3112,10 +3112,14 @@ void SwUiWriterTest::testEmbeddedDataSource()
     // Data source has a table named Sheet1.
     uno::Reference<sdbc::XDataSource> xDataSource(xDatabaseContext->getByName("calc-data-source"), uno::UNO_QUERY);
     CPPUNIT_ASSERT(xDataSource.is());
-    uno::Reference<sdbcx::XTablesSupplier> xConnection(xDataSource->getConnection("", ""), uno::UNO_QUERY);
-    uno::Reference<container::XNameAccess> xTables(xConnection->getTables(), uno::UNO_QUERY);
+    auto xConnection = xDataSource->getConnection("", "");
+    uno::Reference<container::XNameAccess> xTables(
+        css::uno::Reference<css::sdbcx::XTablesSupplier>(
+            xConnection, uno::UNO_QUERY_THROW)->getTables(),
+        uno::UNO_QUERY);
     CPPUNIT_ASSERT(xTables.is());
     CPPUNIT_ASSERT(xTables->hasByName("Sheet1"));
+    xConnection->close();
 
     // Reload: should still have a component and a data source, too.
     reload("writer8", "embedded-data-source.odt");
@@ -3126,9 +3130,13 @@ void SwUiWriterTest::testEmbeddedDataSource()
     xDataSource.set(xDatabaseContext->getByName("calc-data-source"), uno::UNO_QUERY);
     CPPUNIT_ASSERT(xDataSource.is());
     xConnection.set(xDataSource->getConnection("", ""), uno::UNO_QUERY);
-    xTables.set(xConnection->getTables(), uno::UNO_QUERY);
+    xTables.set(
+        css::uno::Reference<css::sdbcx::XTablesSupplier>(
+            xConnection, uno::UNO_QUERY_THROW)->getTables(),
+        uno::UNO_QUERY);
     CPPUNIT_ASSERT(xTables.is());
     CPPUNIT_ASSERT(xTables->hasByName("Sheet1"));
+    xConnection->close();
 
     // Close: should not have a data source anymore.
     mxComponent->dispose();


More information about the Libreoffice-commits mailing list