release SolarMutex after successful tryToAcquire()
tryToAcquire() locks if successful, so unlock when leaving Change-Id: Ic0bd4b10ccb8419dd40946dbaf393a27e413bf2d
This commit is contained in:
@@ -2757,7 +2757,8 @@ bool ScCompiler::IsMacro( const OUString& rName )
|
|||||||
// formulas are compiled from a threaded import may result in a deadlock.
|
// 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.
|
// Check first if we actually could acquire it and if not bail out.
|
||||||
/* FIXME: yes, but how ... */
|
/* 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");
|
SAL_WARN( "sc.core", "ScCompiler::IsMacro - SolarMutex would deadlock, not obtaining Basic");
|
||||||
return false; // bad luck
|
return false; // bad luck
|
||||||
@@ -2784,6 +2785,7 @@ bool ScCompiler::IsMacro( const OUString& rName )
|
|||||||
SbxMethod* pMeth = (SbxMethod*) pObj->Find( aName, SbxCLASS_METHOD );
|
SbxMethod* pMeth = (SbxMethod*) pObj->Find( aName, SbxCLASS_METHOD );
|
||||||
if( !pMeth )
|
if( !pMeth )
|
||||||
{
|
{
|
||||||
|
rSolarMutex.release();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
// It really should be a BASIC function!
|
// It really should be a BASIC function!
|
||||||
@@ -2791,12 +2793,14 @@ bool ScCompiler::IsMacro( const OUString& rName )
|
|||||||
|| ( pMeth->IsFixed() && pMeth->GetType() == SbxEMPTY )
|
|| ( pMeth->IsFixed() && pMeth->GetType() == SbxEMPTY )
|
||||||
|| !pMeth->ISA(SbMethod) )
|
|| !pMeth->ISA(SbMethod) )
|
||||||
{
|
{
|
||||||
|
rSolarMutex.release();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
ScRawToken aToken;
|
ScRawToken aToken;
|
||||||
aToken.SetExternal( aName.getStr() );
|
aToken.SetExternal( aName.getStr() );
|
||||||
aToken.eOp = ocMacro;
|
aToken.eOp = ocMacro;
|
||||||
pRawToken = aToken.Clone();
|
pRawToken = aToken.Clone();
|
||||||
|
rSolarMutex.release();
|
||||||
return true;
|
return true;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user