diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2016-12-29 23:32:49 +0100 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2016-12-29 23:32:49 +0100 |
commit | 4323d81598db774050ffc45bfa96803f747b5729 (patch) | |
tree | ff0d4bc7d5cedf6b1d5d019d211316b39ee8ec50 /sw/qa | |
parent | 0d60ef79bb06fbabbc4ebbff0d583470f2f582c7 (diff) |
Close XConnection when done
Change-Id: Icea70da002f88752603ad21482975d1707d29520
Diffstat (limited to 'sw/qa')
-rw-r--r-- | sw/qa/extras/uiwriter/uiwriter.cxx | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/sw/qa/extras/uiwriter/uiwriter.cxx b/sw/qa/extras/uiwriter/uiwriter.cxx index 1f4c03229bba..5ac5648a6a9d 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(); |