Kaydet (Commit) 32f4f3b5 authored tarafından Noel Grandin's avatar Noel Grandin

use rtl::Reference in bib::OComponentListener

rather than manual acquire/release

Change-Id: Ib4b52fb4a85223f974e9905bc3d02eb839150030
üst 2bbf21aa
...@@ -32,31 +32,16 @@ namespace bib ...@@ -32,31 +32,16 @@ namespace bib
OComponentListener::~OComponentListener() OComponentListener::~OComponentListener()
{ {
{ ::osl::MutexGuard aGuard( m_rMutex );
::osl::MutexGuard aGuard( m_rMutex ); if ( m_xAdapter.is() )
if ( m_pAdapter ) m_xAdapter->dispose();
m_pAdapter->dispose();
}
} }
void OComponentListener::setAdapter( OComponentAdapterBase* pAdapter ) void OComponentListener::setAdapter( OComponentAdapterBase* pAdapter )
{ {
{ ::osl::MutexGuard aGuard( m_rMutex );
::osl::MutexGuard aGuard( m_rMutex ); m_xAdapter = pAdapter;
if ( m_pAdapter )
{
m_pAdapter->release();
m_pAdapter = nullptr;
}
}
if ( pAdapter )
{
::osl::MutexGuard aGuard( m_rMutex );
m_pAdapter = pAdapter;
m_pAdapter->acquire();
}
} }
OComponentAdapterBase::OComponentAdapterBase( const Reference< XComponent >& _rxComp ) OComponentAdapterBase::OComponentAdapterBase( const Reference< XComponent >& _rxComp )
......
...@@ -24,6 +24,7 @@ ...@@ -24,6 +24,7 @@
#include <com/sun/star/lang/XComponent.hpp> #include <com/sun/star/lang/XComponent.hpp>
#include <cppuhelper/implbase.hxx> #include <cppuhelper/implbase.hxx>
#include <com/sun/star/form/XLoadable.hpp> #include <com/sun/star/form/XLoadable.hpp>
#include <rtl/ref.hxx>
namespace bib namespace bib
...@@ -37,12 +38,11 @@ namespace bib ...@@ -37,12 +38,11 @@ namespace bib
friend class OComponentAdapterBase; friend class OComponentAdapterBase;
private: private:
OComponentAdapterBase* m_pAdapter; rtl::Reference<OComponentAdapterBase> m_xAdapter;
::osl::Mutex& m_rMutex; ::osl::Mutex& m_rMutex;
protected: protected:
explicit OComponentListener( ::osl::Mutex& _rMutex ) explicit OComponentListener( ::osl::Mutex& _rMutex )
:m_pAdapter( nullptr ) :m_rMutex( _rMutex )
,m_rMutex( _rMutex )
{ {
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment