extend mutex protection to the whole of ScEditUtil::GetString()

Otherwise with Calc's threading enabled and novell#306440-1.xlsx
this function gets called multiple times at the same time and
the SetText() calls operate on the same object.

Change-Id: Ic044132ac98bed46440aadbdad6ad36f3a2e9beb
Reviewed-on: https://gerrit.libreoffice.org/54520
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
This commit is contained in:
Luboš Luňák
2018-05-18 10:49:37 +02:00
committed by Michael Meeks
parent 539d939cbd
commit 1464b94ab8

View File

@@ -112,6 +112,8 @@ OUString ScEditUtil::GetMultilineString( const EditTextObject& rEdit )
OUString ScEditUtil::GetString( const EditTextObject& rEditText, const ScDocument* pDoc )
{
static osl::Mutex aMutex;
osl::MutexGuard aGuard( aMutex);
// ScFieldEditEngine is needed to resolve field contents.
if (pDoc)
{
@@ -124,8 +126,6 @@ OUString ScEditUtil::GetString( const EditTextObject& rEditText, const ScDocumen
}
else
{
static osl::Mutex aMutex;
osl::MutexGuard aGuard( aMutex);
EditEngine& rEE = ScGlobal::GetStaticFieldEditEngine();
rEE.SetText( rEditText);
return GetMultilineString( rEE);