From 1464b94ab8ef58b2620e05d663403684deb19d0c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lubo=C5=A1=20Lu=C5=88=C3=A1k?= Date: Fri, 18 May 2018 10:49:37 +0200 Subject: [PATCH] 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 Reviewed-by: Michael Meeks --- sc/source/core/tool/editutil.cxx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sc/source/core/tool/editutil.cxx b/sc/source/core/tool/editutil.cxx index e56a1b2ca437..d05cac306c86 100644 --- a/sc/source/core/tool/editutil.cxx +++ b/sc/source/core/tool/editutil.cxx @@ -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);