diff options
Diffstat (limited to 'sc')
-rw-r--r-- | sc/source/core/data/documen3.cxx | 5 | ||||
-rw-r--r-- | sc/source/core/tool/compiler.cxx | 7 |
2 files changed, 4 insertions, 8 deletions
diff --git a/sc/source/core/data/documen3.cxx b/sc/source/core/data/documen3.cxx index 6bf981c07a7c..739b1f34dc20 100644 --- a/sc/source/core/data/documen3.cxx +++ b/sc/source/core/data/documen3.cxx @@ -877,13 +877,12 @@ void ScDocument::RemoveUnoObject( SfxListener& rObject ) // This check is done after calling EndListening, so a later BroadcastUno call // won't touch this object. - comphelper::SolarMutex& rSolarMutex = Application::GetSolarMutex(); - if ( rSolarMutex.tryToAcquire() ) + vcl::SolarMutexTryAndBuyGuard g; + if (g.isAcquired()) { // BroadcastUno is always called with the SolarMutex locked, so if it // can be acquired, this is within the same thread (should not happen) OSL_FAIL( "RemoveUnoObject called from BroadcastUno" ); - rSolarMutex.release(); } else { diff --git a/sc/source/core/tool/compiler.cxx b/sc/source/core/tool/compiler.cxx index b4872e2833a2..fa98f83813a1 100644 --- a/sc/source/core/tool/compiler.cxx +++ b/sc/source/core/tool/compiler.cxx @@ -2819,8 +2819,8 @@ bool ScCompiler::IsMacro( const OUString& rName ) // formulas are compiled from a threaded import may result in a deadlock. // Check first if we actually could acquire it and if not bail out. /* FIXME: yes, but how ... */ - comphelper::SolarMutex& rSolarMutex = Application::GetSolarMutex(); - if (!rSolarMutex.tryToAcquire()) + vcl::SolarMutexTryAndBuyGuard g; + if (!g.isAcquired()) { SAL_WARN( "sc.core", "ScCompiler::IsMacro - SolarMutex would deadlock, not obtaining Basic"); return false; // bad luck @@ -2854,7 +2854,6 @@ bool ScCompiler::IsMacro( const OUString& rName ) SbxMethod* pMeth = (SbxMethod*) pObj->Find( aName, SbxCLASS_METHOD ); if( !pMeth ) { - rSolarMutex.release(); return false; } // It really should be a BASIC function! @@ -2862,12 +2861,10 @@ bool ScCompiler::IsMacro( const OUString& rName ) || ( pMeth->IsFixed() && pMeth->GetType() == SbxEMPTY ) || !pMeth->ISA(SbMethod) ) { - rSolarMutex.release(); return false; } maRawToken.SetExternal( aName.getStr() ); maRawToken.eOp = ocMacro; - rSolarMutex.release(); return true; #endif } |