[Libreoffice-commits] core.git: sc/source

Eike Rathke erack at redhat.com
Thu Nov 14 10:12:08 PST 2013


 sc/source/core/tool/compiler.cxx |   13 +++++++++++++
 1 file changed, 13 insertions(+)

New commits:
commit 63fc020a890e245c8067609aad53bfcc18d69e1b
Author: Eike Rathke <erack at redhat.com>
Date:   Thu Nov 14 19:10:27 2013 +0100

    workaround to prevent deadlock in obtaining Basic during threaded import
    
    Change-Id: I730c179c117ffddf7ddf49ca0ea0a6e5217d4b2e

diff --git a/sc/source/core/tool/compiler.cxx b/sc/source/core/tool/compiler.cxx
index ebc31967..b297f66 100644
--- a/sc/source/core/tool/compiler.cxx
+++ b/sc/source/core/tool/compiler.cxx
@@ -2826,6 +2826,19 @@ bool ScCompiler::IsMacro( const OUString& rName )
 
     return false;
 #else
+
+    // Calling SfxObjectShell::GetBasic() may result in all sort of things
+    // including obtaining the model and deep down in
+    // SfxBaseModel::getDocumentStorage() acquiring the SolarMutex, which when
+    // 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())
+    {
+        SAL_WARN( "sc.core", "ScCompiler::IsMacro - SolarMutex would deadlock, not obtaining Basic");
+        return false;   // bad luck
+    }
+
     OUString aName( rName);
     StarBASIC* pObj = 0;
     SfxObjectShell* pDocSh = pDoc->GetDocumentShell();


More information about the Libreoffice-commits mailing list