diff options
Diffstat (limited to 'bridges/source/remote')
-rw-r--r-- | bridges/source/remote/urp/urp_environment.cxx | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/bridges/source/remote/urp/urp_environment.cxx b/bridges/source/remote/urp/urp_environment.cxx index 5d1c4b9ab741..fd0c56ba4376 100644 --- a/bridges/source/remote/urp/urp_environment.cxx +++ b/bridges/source/remote/urp/urp_environment.cxx @@ -182,6 +182,7 @@ struct StaticSingleton { ~StaticSingleton() { + ::osl::MutexGuard guard( ::osl::Mutex::getGlobalMutex() ); g_bStaticDestructorsCalled = sal_True; } }; @@ -267,7 +268,13 @@ static void SAL_CALL RemoteEnvironment_thisDispose( uno_Environment *pEnvRemote } // in case, that the static destructors already have been called, no // tiding up is done. - if( ! g_bStaticDestructorsCalled && ! pContext->m_pBridgeImpl->m_bDisposed ) + bool tidyUp; + { + ::osl::MutexGuard guard2( ::osl::Mutex::getGlobalMutex() ); + tidyUp = ! g_bStaticDestructorsCalled && + ! pContext->m_pBridgeImpl->m_bDisposed; + } + if( tidyUp ) { // TODO : not threadsafe // synchronization with dispatch methods needed ! @@ -335,9 +342,12 @@ static void SAL_CALL RemoteEnvironment_thisDispose( uno_Environment *pEnvRemote pImpl->m_pReader = 0; } - // delete the stubs - releaseStubs( pEnvRemote ); - + ::osl::MutexGuard guard2( ::osl::Mutex::getGlobalMutex() ); + if( ! g_bStaticDestructorsCalled ) + { + // delete the stubs + releaseStubs( pEnvRemote ); + } } } |