diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-10-17 14:39:41 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-10-18 08:35:05 +0200 |
commit | 2ed9c74136b3d20aa837632a1f9ad8259f808e86 (patch) | |
tree | 49eeed795788fd4ac567a2d18ed2eda069d1f23d /dbaccess | |
parent | a4d0eef39b063dad1fe3565feb6d2c9932b87216 (diff) |
use rtl::Reference in ODatabaseContext
Change-Id: I6ed51a1eabe240c199b9f250744729b19efdd24e
Reviewed-on: https://gerrit.libreoffice.org/43457
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'dbaccess')
-rw-r--r-- | dbaccess/source/core/dataaccess/databasecontext.cxx | 11 | ||||
-rw-r--r-- | dbaccess/source/core/inc/databasecontext.hxx | 2 | ||||
-rw-r--r-- | dbaccess/source/ui/inc/TokenWriter.hxx | 1 | ||||
-rw-r--r-- | dbaccess/source/ui/misc/TokenWriter.cxx | 26 |
4 files changed, 12 insertions, 28 deletions
diff --git a/dbaccess/source/core/dataaccess/databasecontext.cxx b/dbaccess/source/core/dataaccess/databasecontext.cxx index d065fff224a5..734f7353a998 100644 --- a/dbaccess/source/core/dataaccess/databasecontext.cxx +++ b/dbaccess/source/core/dataaccess/databasecontext.cxx @@ -125,7 +125,6 @@ namespace dbaccess DatabaseDocumentLoader::DatabaseDocumentLoader( const Reference<XComponentContext> & rxContext ) { - acquire(); try { m_xDesktop.set( Desktop::create(rxContext) ); @@ -175,7 +174,7 @@ ODatabaseContext::ODatabaseContext( const Reference< XComponentContext >& _rxCon ,m_aContext( _rxContext ) ,m_aContainerListeners(m_aMutex) { - m_pDatabaseDocumentLoader = new DatabaseDocumentLoader( _rxContext ); + m_xDatabaseDocumentLoader = new DatabaseDocumentLoader( _rxContext ); #if HAVE_FEATURE_SCRIPTING ::basic::BasicManagerRepository::registerCreationListener( *this ); @@ -197,9 +196,7 @@ ODatabaseContext::~ODatabaseContext() ::basic::BasicManagerRepository::revokeCreationListener( *this ); #endif - if ( m_pDatabaseDocumentLoader ) - m_pDatabaseDocumentLoader->release(); - + m_xDatabaseDocumentLoader.clear(); m_xDBRegistrationAggregate->setDelegator( nullptr ); m_xDBRegistrationAggregate.clear(); m_xDatabaseRegistrations.clear(); @@ -389,12 +386,12 @@ Reference< XInterface > ODatabaseContext::loadObjectFromURL(const OUString& _rNa void ODatabaseContext::appendAtTerminateListener(const ODatabaseModelImpl& _rDataSourceModel) { - m_pDatabaseDocumentLoader->append(_rDataSourceModel); + m_xDatabaseDocumentLoader->append(_rDataSourceModel); } void ODatabaseContext::removeFromTerminateListener(const ODatabaseModelImpl& _rDataSourceModel) { - m_pDatabaseDocumentLoader->remove(_rDataSourceModel); + m_xDatabaseDocumentLoader->remove(_rDataSourceModel); } void ODatabaseContext::setTransientProperties(const OUString& _sURL, ODatabaseModelImpl& _rDataSourceModel ) diff --git a/dbaccess/source/core/inc/databasecontext.hxx b/dbaccess/source/core/inc/databasecontext.hxx index 52b2a90ce579..3aac43f4ca9c 100644 --- a/dbaccess/source/core/inc/databasecontext.hxx +++ b/dbaccess/source/core/inc/databasecontext.hxx @@ -107,7 +107,7 @@ protected: // properties. ::comphelper::OInterfaceContainerHelper2 m_aContainerListeners; - DatabaseDocumentLoader* m_pDatabaseDocumentLoader; + rtl::Reference<DatabaseDocumentLoader> m_xDatabaseDocumentLoader; public: explicit ODatabaseContext( const css::uno::Reference< css::uno::XComponentContext >& ); diff --git a/dbaccess/source/ui/inc/TokenWriter.hxx b/dbaccess/source/ui/inc/TokenWriter.hxx index 8dfaa504781b..66ac32d6f9b0 100644 --- a/dbaccess/source/ui/inc/TokenWriter.hxx +++ b/dbaccess/source/ui/inc/TokenWriter.hxx @@ -76,7 +76,6 @@ namespace dbaui sal_Int32 m_nCommandType; bool m_bNeedToReInitialize; - ODatabaseExport* m_pReader; rtl_TextEncoding m_eDestEnc; bool m_bInInitialize; bool m_bCheckOnly; diff --git a/dbaccess/source/ui/misc/TokenWriter.cxx b/dbaccess/source/ui/misc/TokenWriter.cxx index c92c7af6df52..402cdf4a0ea8 100644 --- a/dbaccess/source/ui/misc/TokenWriter.cxx +++ b/dbaccess/source/ui/misc/TokenWriter.cxx @@ -84,7 +84,6 @@ ODatabaseImportExport::ODatabaseImportExport(const svx::ODataAccessDescriptor& _ ,m_xContext(_rM) ,m_nCommandType(CommandType::TABLE) ,m_bNeedToReInitialize(false) - ,m_pReader(nullptr) ,m_bInInitialize(false) ,m_bCheckOnly(false) { @@ -105,7 +104,6 @@ ODatabaseImportExport::ODatabaseImportExport( const ::dbtools::SharedConnection& ,m_xContext(_rM) ,m_nCommandType(css::sdb::CommandType::TABLE) ,m_bNeedToReInitialize(false) - ,m_pReader(nullptr) ,m_bInInitialize(false) ,m_bCheckOnly(false) { @@ -123,11 +121,7 @@ ODatabaseImportExport::ODatabaseImportExport( const ::dbtools::SharedConnection& ODatabaseImportExport::~ODatabaseImportExport() { acquire(); - dispose(); - - if(m_pReader) - m_pReader->release(); } void ODatabaseImportExport::dispose() @@ -575,13 +569,10 @@ bool ORTFImportExport::Read() SvParserState eState = SvParserState::Error; if ( m_pStream ) { - m_pReader = new ORTFReader((*m_pStream),m_xConnection,m_xFormatter,m_xContext); - static_cast<ORTFReader*>(m_pReader)->AddFirstRef(); + tools::SvRef<ORTFReader> xReader(new ORTFReader((*m_pStream),m_xConnection,m_xFormatter,m_xContext)); if ( isCheckEnabled() ) - m_pReader->enableCheckOnly(); - eState = static_cast<ORTFReader*>(m_pReader)->CallParser(); - m_pReader->release(); - m_pReader = nullptr; + xReader->enableCheckOnly(); + eState = xReader->CallParser(); } return eState != SvParserState::Error; @@ -645,14 +636,11 @@ bool OHTMLImportExport::Read() SvParserState eState = SvParserState::Error; if ( m_pStream ) { - m_pReader = new OHTMLReader((*m_pStream),m_xConnection,m_xFormatter,m_xContext); - static_cast<OHTMLReader*>(m_pReader)->AddFirstRef(); + tools::SvRef<OHTMLReader> xReader(new OHTMLReader((*m_pStream),m_xConnection,m_xFormatter,m_xContext)); if ( isCheckEnabled() ) - m_pReader->enableCheckOnly(); - m_pReader->SetTableName(m_sDefaultTableName); - eState = static_cast<OHTMLReader*>(m_pReader)->CallParser(); - m_pReader->release(); - m_pReader = nullptr; + xReader->enableCheckOnly(); + xReader->SetTableName(m_sDefaultTableName); + eState = xReader->CallParser(); } return eState != SvParserState::Error; |