Kaydet (Commit) 26b79470 authored tarafından Michael Stahl's avatar Michael Stahl

basic::ImplRepository: use SolarMutex instead of own mutex

The locking strategy in the basic module is totally unclear to me, there
does not appear to be a dedicated mutex for the core stuff callable via
StarBASIC, just a bunch of SolarMutexGuards at random locations;
let's try to use SolarMutex at the UNO entry points...

Change-Id: Ia9c45fdcfb5ffd0a4acc77ef5d2fabfb8743ad38
üst e52758fe
...@@ -81,7 +81,6 @@ namespace basic ...@@ -81,7 +81,6 @@ namespace basic
ImplRepository(); ImplRepository();
private: private:
::osl::Mutex m_aMutex;
BasicManagerStore m_aStore; BasicManagerStore m_aStore;
CreationListeners m_aCreationListeners; CreationListeners m_aCreationListeners;
...@@ -222,7 +221,7 @@ namespace basic ...@@ -222,7 +221,7 @@ namespace basic
BasicManager* ImplRepository::getDocumentBasicManager( const Reference< XModel >& _rxDocumentModel ) BasicManager* ImplRepository::getDocumentBasicManager( const Reference< XModel >& _rxDocumentModel )
{ {
::osl::MutexGuard aGuard( m_aMutex ); SolarMutexGuard g;
/* #163556# (DR) - This function may be called recursively while /* #163556# (DR) - This function may be called recursively while
constructing the Basic manager and loading the Basic storage. By constructing the Basic manager and loading the Basic storage. By
...@@ -242,7 +241,7 @@ namespace basic ...@@ -242,7 +241,7 @@ namespace basic
BasicManager* ImplRepository::getApplicationBasicManager( bool _bCreate ) BasicManager* ImplRepository::getApplicationBasicManager( bool _bCreate )
{ {
::osl::MutexGuard aGuard( m_aMutex ); SolarMutexGuard g;
BasicManager* pAppManager = GetSbData()->pAppBasMgr; BasicManager* pAppManager = GetSbData()->pAppBasMgr;
if ( ( pAppManager == NULL ) && _bCreate ) if ( ( pAppManager == NULL ) && _bCreate )
...@@ -254,7 +253,7 @@ namespace basic ...@@ -254,7 +253,7 @@ namespace basic
void ImplRepository::setApplicationBasicManager( BasicManager* _pBasicManager ) void ImplRepository::setApplicationBasicManager( BasicManager* _pBasicManager )
{ {
::osl::MutexGuard aGuard( m_aMutex ); SolarMutexGuard g;
BasicManager* pPreviousManager = getApplicationBasicManager( false ); BasicManager* pPreviousManager = getApplicationBasicManager( false );
delete pPreviousManager; delete pPreviousManager;
...@@ -265,7 +264,8 @@ namespace basic ...@@ -265,7 +264,8 @@ namespace basic
BasicManager* ImplRepository::impl_createApplicationBasicManager() BasicManager* ImplRepository::impl_createApplicationBasicManager()
{ {
::osl::MutexGuard aGuard( m_aMutex ); SolarMutexGuard g;
OSL_PRECOND( getApplicationBasicManager( false ) == NULL, "ImplRepository::impl_createApplicationBasicManager: there already is one!" ); OSL_PRECOND( getApplicationBasicManager( false ) == NULL, "ImplRepository::impl_createApplicationBasicManager: there already is one!" );
// Determine Directory // Determine Directory
...@@ -324,14 +324,16 @@ namespace basic ...@@ -324,14 +324,16 @@ namespace basic
void ImplRepository::registerCreationListener( BasicManagerCreationListener& _rListener ) void ImplRepository::registerCreationListener( BasicManagerCreationListener& _rListener )
{ {
::osl::MutexGuard aGuard( m_aMutex ); SolarMutexGuard g;
m_aCreationListeners.push_back( &_rListener ); m_aCreationListeners.push_back( &_rListener );
} }
void ImplRepository::revokeCreationListener( BasicManagerCreationListener& _rListener ) void ImplRepository::revokeCreationListener( BasicManagerCreationListener& _rListener )
{ {
::osl::MutexGuard aGuard( m_aMutex ); SolarMutexGuard g;
CreationListeners::iterator pos = ::std::find( m_aCreationListeners.begin(), m_aCreationListeners.end(), &_rListener ); CreationListeners::iterator pos = ::std::find( m_aCreationListeners.begin(), m_aCreationListeners.end(), &_rListener );
if ( pos != m_aCreationListeners.end() ) if ( pos != m_aCreationListeners.end() )
m_aCreationListeners.erase( pos ); m_aCreationListeners.erase( pos );
...@@ -542,7 +544,7 @@ namespace basic ...@@ -542,7 +544,7 @@ namespace basic
void ImplRepository::_disposing( const ::com::sun::star::lang::EventObject& _rSource ) void ImplRepository::_disposing( const ::com::sun::star::lang::EventObject& _rSource )
{ {
::osl::MutexGuard aGuard( m_aMutex ); SolarMutexGuard g;
Reference< XInterface > xNormalizedSource( _rSource.Source, UNO_QUERY ); Reference< XInterface > xNormalizedSource( _rSource.Source, UNO_QUERY );
#if OSL_DEBUG_LEVEL > 0 #if OSL_DEBUG_LEVEL > 0
......
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