[Libreoffice-commits] core.git: comphelper/source
Noel Grandin
noel.grandin at collabora.co.uk
Tue Jan 17 07:53:56 UTC 2017
comphelper/source/misc/instancelocker.cxx | 14 ++++----------
comphelper/source/misc/instancelocker.hxx | 4 ++--
2 files changed, 6 insertions(+), 12 deletions(-)
New commits:
commit ee2bd1ee97194f4d39d4d6ab95c9b926b5077cb8
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date: Mon Jan 16 10:36:39 2017 +0200
use rtl::Reference in OInstanceLocker
no need to store a raw pointer and a refcount pointer
Change-Id: I2dc3b87dd870c8d8128c2249a18fda30319ba08c
Reviewed-on: https://gerrit.libreoffice.org/33157
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>
diff --git a/comphelper/source/misc/instancelocker.cxx b/comphelper/source/misc/instancelocker.cxx
index 11bc0e1..e6a39e8 100644
--- a/comphelper/source/misc/instancelocker.cxx
+++ b/comphelper/source/misc/instancelocker.cxx
@@ -38,8 +38,7 @@ using namespace ::com::sun::star;
OInstanceLocker::OInstanceLocker()
-: m_pLockListener( nullptr )
-, m_pListenersContainer( nullptr )
+: m_pListenersContainer( nullptr )
, m_bDisposed( false )
, m_bInitialized( false )
{
@@ -81,11 +80,7 @@ void SAL_CALL OInstanceLocker::dispose()
if ( m_xLockListener.is() )
{
- if ( m_pLockListener )
- {
- m_pLockListener->Dispose();
- m_pLockListener = nullptr;
- }
+ m_xLockListener->Dispose();
m_xLockListener.clear();
}
@@ -169,12 +164,11 @@ void SAL_CALL OInstanceLocker::initialize( const uno::Sequence< uno::Any >& aArg
uno::Reference< uno::XInterface >(),
0 );
- m_pLockListener = new OLockListener( uno::Reference< lang::XComponent > ( static_cast< lang::XComponent* >( this ) ),
+ m_xLockListener = new OLockListener( uno::Reference< lang::XComponent > ( static_cast< lang::XComponent* >( this ) ),
xInstance,
nModes,
xApproval );
- m_xLockListener.set( static_cast< OWeakObject* >( m_pLockListener ) );
- m_pLockListener->Init();
+ m_xLockListener->Init();
}
catch( uno::Exception& )
{
diff --git a/comphelper/source/misc/instancelocker.hxx b/comphelper/source/misc/instancelocker.hxx
index 6960e1d..df6c39c 100644
--- a/comphelper/source/misc/instancelocker.hxx
+++ b/comphelper/source/misc/instancelocker.hxx
@@ -32,6 +32,7 @@
#include <osl/mutex.hxx>
#include <cppuhelper/implbase.hxx>
#include <comphelper/interfacecontainer2.hxx>
+#include <rtl/ref.hxx>
class OLockListener;
@@ -44,8 +45,7 @@ class OInstanceLocker : public ::cppu::WeakImplHelper< css::lang::XComponent,
{
::osl::Mutex m_aMutex;
- css::uno::Reference< css::uno::XInterface > m_xLockListener;
- OLockListener* m_pLockListener;
+ rtl::Reference< OLockListener > m_xLockListener;
::comphelper::OInterfaceContainerHelper2* m_pListenersContainer; // list of listeners
More information about the Libreoffice-commits
mailing list