summaryrefslogtreecommitdiff
path: root/sc/source/core
diff options
context:
space:
mode:
authorEike Rathke <erack@redhat.com>2013-12-02 16:05:02 +0100
committerEike Rathke <erack@redhat.com>2013-12-02 16:16:51 +0100
commit0a34d4a5af3658be10ea9091096027a159cc7316 (patch)
tree9ec94b8f8ece7aa4942ca7051870a2abd02f4291 /sc/source/core
parent5b8b567762c6573eaf35ffa6508c0354fba68f34 (diff)
release SolarMutex after successful tryToAcquire()
tryToAcquire() locks if successful, so unlock when leaving Change-Id: Ic0bd4b10ccb8419dd40946dbaf393a27e413bf2d (cherry picked from commit e56105a1f24e9eac491c32c841030c69fb2e2d30)
Diffstat (limited to 'sc/source/core')
-rw-r--r--sc/source/core/tool/compiler.cxx6
1 files changed, 5 insertions, 1 deletions
diff --git a/sc/source/core/tool/compiler.cxx b/sc/source/core/tool/compiler.cxx
index e68cf55d6ae3..55b10c3f4568 100644
--- a/sc/source/core/tool/compiler.cxx
+++ b/sc/source/core/tool/compiler.cxx
@@ -2757,7 +2757,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 ... */
- if (!Application::GetSolarMutex().tryToAcquire())
+ comphelper::SolarMutex& rSolarMutex = Application::GetSolarMutex();
+ if (!rSolarMutex.tryToAcquire())
{
SAL_WARN( "sc.core", "ScCompiler::IsMacro - SolarMutex would deadlock, not obtaining Basic");
return false; // bad luck
@@ -2784,6 +2785,7 @@ 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!
@@ -2791,12 +2793,14 @@ bool ScCompiler::IsMacro( const OUString& rName )
|| ( pMeth->IsFixed() && pMeth->GetType() == SbxEMPTY )
|| !pMeth->ISA(SbMethod) )
{
+ rSolarMutex.release();
return false;
}
ScRawToken aToken;
aToken.SetExternal( aName.getStr() );
aToken.eOp = ocMacro;
pRawToken = aToken.Clone();
+ rSolarMutex.release();
return true;
#endif
}