diff options
author | Noel Grandin <noel@peralex.com> | 2016-06-01 16:22:29 +0200 |
---|---|---|
committer | Noel Grandin <noelgrandin@gmail.com> | 2016-06-06 07:01:34 +0000 |
commit | 0323253a7c67316cb96e4a64792ab4fe74aac1ca (patch) | |
tree | 81787c4ae44ff778aa41e12574cd60a624c9277b /connectivity/source/drivers/mork | |
parent | 4d666f5092d7c4f2ece9702dda4d874e44cdc6f7 (diff) |
remove some manual ref-counting
triggered when I noticed a class doing acquire() in the
constructor and then release() in the destructor.
found mostly by
git grep -n -B5 -e '->release()'
Change-Id: I96e43a3d30ffd9ae9a34275f24cd914d8f7b026f
Reviewed-on: https://gerrit.libreoffice.org/25806
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
Diffstat (limited to 'connectivity/source/drivers/mork')
-rw-r--r-- | connectivity/source/drivers/mork/MConnection.cxx | 7 | ||||
-rw-r--r-- | connectivity/source/drivers/mork/MConnection.hxx | 6 |
2 files changed, 5 insertions, 8 deletions
diff --git a/connectivity/source/drivers/mork/MConnection.cxx b/connectivity/source/drivers/mork/MConnection.cxx index 301aa7b8000d..d0caa2e98b33 100644 --- a/connectivity/source/drivers/mork/MConnection.cxx +++ b/connectivity/source/drivers/mork/MConnection.cxx @@ -40,10 +40,9 @@ static const int defaultScope = 0x80; OConnection::OConnection(MorkDriver* _pDriver) :OSubComponent<OConnection, OConnection_BASE>(static_cast<cppu::OWeakObject*>(_pDriver), this) - ,m_pDriver(_pDriver) + ,m_xDriver(_pDriver) ,m_aColumnAlias( _pDriver->getFactory() ) { - m_pDriver->acquire(); m_pBook = new MorkParser(); m_pHistory = new MorkParser(); } @@ -52,8 +51,6 @@ OConnection::~OConnection() { if(!isClosed()) close(); - m_pDriver->release(); - m_pDriver = nullptr; delete m_pBook; delete m_pHistory; } @@ -112,7 +109,7 @@ void OConnection::construct(const OUString& url,const Sequence< PropertyValue >& // production? if (unittestIndex == -1) { - OUString path = m_pDriver->getProfilePath(); + OUString path = m_xDriver->getProfilePath(); SAL_INFO("connectivity.mork", "ProfilePath: " << path); abook = path + "/abook.mab"; history = path + "/history.mab"; diff --git a/connectivity/source/drivers/mork/MConnection.hxx b/connectivity/source/drivers/mork/MConnection.hxx index e87c01b5fe44..125908fd9d62 100644 --- a/connectivity/source/drivers/mork/MConnection.hxx +++ b/connectivity/source/drivers/mork/MConnection.hxx @@ -37,8 +37,8 @@ namespace connectivity // Data attributes - MorkDriver* m_pDriver; // Pointer to the owning - // driver object + rtl::Reference<MorkDriver> m_xDriver; // Pointer to the owning + // driver object OColumnAlias m_aColumnAlias; // Mork Parser (abook) MorkParser* m_pBook; @@ -52,7 +52,7 @@ namespace connectivity explicit OConnection(MorkDriver* const driver); virtual ~OConnection(); - MorkDriver* getDriver() {return m_pDriver;}; + const rtl::Reference<MorkDriver>& getDriver() {return m_xDriver;}; MorkParser* getMorkParser(const OString& t) {return t == "CollectedAddressBook" ? m_pHistory : m_pBook;}; // OComponentHelper |