diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-01-19 16:02:25 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-01-20 08:51:08 +0200 |
commit | 3bb8bdb93f1546f64ff3f183d6162c41a03856bf (patch) | |
tree | 3e420ad9b90da186b5364f14d6dfd0d3a01e77f6 /comphelper | |
parent | 3663edf465e87d823e354b320b8d072f7764d5dc (diff) |
use rtl::Reference in OContainerListener
instead of manual acquire/release
Change-Id: I83e6229029e662073e2e01e98f4846fb0a0ed643
Diffstat (limited to 'comphelper')
-rw-r--r-- | comphelper/source/container/containermultiplexer.cxx | 23 |
1 files changed, 5 insertions, 18 deletions
diff --git a/comphelper/source/container/containermultiplexer.cxx b/comphelper/source/container/containermultiplexer.cxx index b7e3c93becbe..e80f550bb02e 100644 --- a/comphelper/source/container/containermultiplexer.cxx +++ b/comphelper/source/container/containermultiplexer.cxx @@ -29,18 +29,16 @@ namespace comphelper using namespace ::com::sun::star::container; OContainerListener::OContainerListener(::osl::Mutex& _rMutex) - :m_pAdapter(nullptr) - ,m_rMutex(_rMutex) + :m_rMutex(_rMutex) { } OContainerListener::~OContainerListener() { - if (m_pAdapter) + if (m_xAdapter.is()) { - m_pAdapter->dispose(); - m_pAdapter = nullptr; + m_xAdapter->dispose(); } } @@ -71,19 +69,8 @@ namespace comphelper void OContainerListener::setAdapter(OContainerListenerAdapter* pAdapter) { - if (m_pAdapter) - { - ::osl::MutexGuard aGuard(m_rMutex); - m_pAdapter->release(); - m_pAdapter = nullptr; - } - - if (pAdapter) - { - ::osl::MutexGuard aGuard(m_rMutex); - m_pAdapter = pAdapter; - m_pAdapter->acquire(); - } + ::osl::MutexGuard aGuard(m_rMutex); + m_xAdapter = pAdapter; } OContainerListenerAdapter::OContainerListenerAdapter(OContainerListener* _pListener, |