diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-05-08 12:42:55 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-05-14 11:10:15 +0200 |
commit | a245e5c60fac58889738a9705225c6378b35eef4 (patch) | |
tree | 67a236687c2c3a61b23f7a31facc5d0fa9d6e4eb | |
parent | 858e6b266476e5a18111fce883465e734942a50f (diff) |
loplugin:useuniqueptr in ORowSet
hold this by rtl::Reference since we are taking references to it
elsewhere and passing them around.
Change-Id: Iae68d7da67cf84f01deb6bb42c00e4c74d7a99d7
Reviewed-on: https://gerrit.libreoffice.org/54169
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
-rw-r--r-- | dbaccess/source/core/api/RowSet.cxx | 17 | ||||
-rw-r--r-- | dbaccess/source/core/api/RowSet.hxx | 2 | ||||
-rw-r--r-- | dbaccess/source/core/inc/tablecontainer.hxx | 5 |
3 files changed, 12 insertions, 12 deletions
diff --git a/dbaccess/source/core/api/RowSet.cxx b/dbaccess/source/core/api/RowSet.cxx index 77abccbaf3e1..f7c7f95cdac5 100644 --- a/dbaccess/source/core/api/RowSet.cxx +++ b/dbaccess/source/core/api/RowSet.cxx @@ -135,7 +135,6 @@ ORowSet::ORowSet( const Reference< css::uno::XComponentContext >& _rxContext ) ,m_aRowsetListeners(*m_pMutex) ,m_aApproveListeners(*m_pMutex) ,m_aRowsChangeListener(*m_pMutex) - ,m_pTables(nullptr) ,m_nFetchDirection(FetchDirection::FORWARD) ,m_nFetchSize(50) ,m_nMaxFieldSize(0) @@ -2244,9 +2243,9 @@ Reference< XNameAccess > ORowSet::impl_getTables_throw() { xTables.set( xTablesAccess->getTables(), UNO_QUERY_THROW ); } - else if ( m_pTables ) + else if ( m_xTables ) { - xTables = m_pTables; + xTables = m_xTables.get(); } else { @@ -2264,10 +2263,10 @@ Reference< XNameAccess > ORowSet::impl_getTables_throw() DBG_UNHANDLED_EXCEPTION("dbaccess"); } - m_pTables = new OTableContainer(*this,m_aMutex,m_xActiveConnection,bCase,nullptr,nullptr,m_nInAppend); - xTables = m_pTables; + m_xTables = new OTableContainer(*this,m_aMutex,m_xActiveConnection,bCase,nullptr,nullptr,m_nInAppend); + xTables = m_xTables.get(); Sequence<OUString> aTableFilter { "%" }; - m_pTables->construct(aTableFilter,Sequence< OUString>()); + m_xTables->construct(aTableFilter,Sequence< OUString>()); } return xTables; @@ -2275,19 +2274,19 @@ Reference< XNameAccess > ORowSet::impl_getTables_throw() void ORowSet::impl_resetTables_nothrow() { - if ( !m_pTables ) + if ( !m_xTables ) return; try { - m_pTables->dispose(); + m_xTables->dispose(); } catch( const Exception& ) { DBG_UNHANDLED_EXCEPTION("dbaccess"); } - DELETEZ( m_pTables ); + m_xTables.clear(); } void ORowSet::impl_initComposer_throw( OUString& _out_rCommandToExecute ) diff --git a/dbaccess/source/core/api/RowSet.hxx b/dbaccess/source/core/api/RowSet.hxx index a059f8f74420..6c66c159fc13 100644 --- a/dbaccess/source/core/api/RowSet.hxx +++ b/dbaccess/source/core/api/RowSet.hxx @@ -104,7 +104,7 @@ namespace dbaccess ::dbtools::WarningsContainer m_aWarnings; - OTableContainer* m_pTables; + rtl::Reference<OTableContainer> m_xTables; OUString m_aCommand; OUString m_aDataSourceName; diff --git a/dbaccess/source/core/inc/tablecontainer.hxx b/dbaccess/source/core/inc/tablecontainer.hxx index 36055e3e8a5e..0374f3e5121b 100644 --- a/dbaccess/source/core/inc/tablecontainer.hxx +++ b/dbaccess/source/core/inc/tablecontainer.hxx @@ -64,8 +64,6 @@ namespace dbaccess virtual void disposing() override; - virtual void SAL_CALL acquire() throw() override { OFilteredContainer::acquire();} - virtual void SAL_CALL release() throw() override { OFilteredContainer::release();} // css::lang::XServiceInfo DECLARE_SERVICE_INFO(); @@ -77,6 +75,9 @@ namespace dbaccess virtual void SAL_CALL elementReplaced( const css::container::ContainerEvent& Event ) override; public: + virtual void SAL_CALL acquire() throw() override { OFilteredContainer::acquire();} + virtual void SAL_CALL release() throw() override { OFilteredContainer::release();} + /** ctor of the container. The parent has to support the <type scope="css::sdbc">XConnection</type> interface.<BR> @param _rParent the object which acts as parent for the container. |