diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2012-06-19 11:59:01 +0200 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2012-06-20 14:44:04 +0200 |
commit | 43a8d203d816321dccbaec38b6e8307f98f0249d (patch) | |
tree | 729299be91736f008a7604368a8f0795c50cde7c /vcl | |
parent | e100891fecc777f0d25aef9044373633ae6a34af (diff) |
Mutex lifecycle must encompass WeakComponentImplHelper base
Change-Id: I98a9a22ce1e937b20bcd3b59b4e6677a5a60f762
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/source/app/session.cxx | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/vcl/source/app/session.cxx b/vcl/source/app/session.cxx index 0ac6bffe869d..045d9764d2c7 100644 --- a/vcl/source/app/session.cxx +++ b/vcl/source/app/session.cxx @@ -61,7 +61,9 @@ SalSession::~SalSession() { } -class VCLSession : public cppu::WeakComponentImplHelper1 < XSessionManagerClient > +class VCLSession: + private osl::Mutex, + public cppu::WeakComponentImplHelper1 < XSessionManagerClient > { struct Listener { @@ -80,7 +82,6 @@ class VCLSession : public cppu::WeakComponentImplHelper1 < XSessionManagerClient std::list< Listener > m_aListeners; boost::scoped_ptr< SalSession > m_pSession; - osl::Mutex m_aMutex; bool m_bInteractionRequested; bool m_bInteractionGranted; bool m_bInteractionDone; @@ -107,7 +108,7 @@ public: }; VCLSession::VCLSession() - : cppu::WeakComponentImplHelper1< XSessionManagerClient >( m_aMutex ), + : cppu::WeakComponentImplHelper1< XSessionManagerClient >( *static_cast< osl::Mutex * >(this) ), m_pSession( ImplGetSVData()->mpDefInst->CreateSalSession() ), m_bInteractionRequested( false ), m_bInteractionGranted( false ), @@ -122,7 +123,7 @@ void VCLSession::callSaveRequested( bool bShutdown, bool bCancelable ) { std::list< Listener > aListeners; { - osl::MutexGuard aGuard( m_aMutex ); + osl::MutexGuard aGuard( *this ); // reset listener states for( std::list< Listener >::iterator it = m_aListeners.begin(); it != m_aListeners.end(); ++it ) @@ -159,7 +160,7 @@ void VCLSession::callInteractionGranted( bool bInteractionGranted ) { std::list< Listener > aListeners; { - osl::MutexGuard aGuard( m_aMutex ); + osl::MutexGuard aGuard( *this ); // copy listener list since calling a listener may remove it. for( std::list< Listener >::const_iterator it = m_aListeners.begin(); it != m_aListeners.end(); ++it ) if( it->m_bInteractionRequested ) @@ -188,7 +189,7 @@ void VCLSession::callShutdownCancelled() { std::list< Listener > aListeners; { - osl::MutexGuard aGuard( m_aMutex ); + osl::MutexGuard aGuard( *this ); // copy listener list since calling a listener may remove it. aListeners = m_aListeners; // set back interaction state @@ -205,7 +206,7 @@ void VCLSession::callQuit() { std::list< Listener > aListeners; { - osl::MutexGuard aGuard( m_aMutex ); + osl::MutexGuard aGuard( *this ); // copy listener list since calling a listener may remove it. aListeners = m_aListeners; // set back interaction state @@ -250,14 +251,14 @@ void VCLSession::SalSessionEventProc( void* pData, SalSessionEvent* pEvent ) void SAL_CALL VCLSession::addSessionManagerListener( const css::uno::Reference<XSessionManagerListener>& xListener ) throw( RuntimeException ) { - osl::MutexGuard aGuard( m_aMutex ); + osl::MutexGuard aGuard( *this ); m_aListeners.push_back( Listener( xListener ) ); } void SAL_CALL VCLSession::removeSessionManagerListener( const css::uno::Reference<XSessionManagerListener>& xListener ) throw( RuntimeException ) { - osl::MutexGuard aGuard( m_aMutex ); + osl::MutexGuard aGuard( *this ); std::list< Listener >::iterator it = m_aListeners.begin(); while( it != m_aListeners.end() ) @@ -283,7 +284,7 @@ void SAL_CALL VCLSession::queryInteraction( const css::uno::Reference<XSessionMa return; } - osl::MutexGuard aGuard( m_aMutex ); + osl::MutexGuard aGuard( *this ); if( ! m_bInteractionRequested ) { m_pSession->queryInteraction(); @@ -301,7 +302,7 @@ void SAL_CALL VCLSession::queryInteraction( const css::uno::Reference<XSessionMa void SAL_CALL VCLSession::interactionDone( const css::uno::Reference< XSessionManagerListener >& xListener ) throw( RuntimeException ) { - osl::MutexGuard aGuard( m_aMutex ); + osl::MutexGuard aGuard( *this ); int nRequested = 0, nDone = 0; for( std::list< Listener >::iterator it = m_aListeners.begin(); it != m_aListeners.end(); ++it ) { @@ -324,7 +325,7 @@ void SAL_CALL VCLSession::interactionDone( const css::uno::Reference< XSessionMa void SAL_CALL VCLSession::saveDone( const css::uno::Reference< XSessionManagerListener >& xListener ) throw( RuntimeException ) { - osl::MutexGuard aGuard( m_aMutex ); + osl::MutexGuard aGuard( *this ); bool bSaveDone = true; for( std::list< Listener >::iterator it = m_aListeners.begin(); |