[Libreoffice-commits] core.git: Branch 'libreoffice-6-1' - 2 commits - sc/source vcl/source
Luboš Luňák
l.lunak at collabora.com
Mon Jun 4 14:14:03 UTC 2018
sc/source/core/data/global.cxx | 53 +++++++++++++++++------------------------
vcl/source/app/svmain.cxx | 20 ++++++++-------
2 files changed, 33 insertions(+), 40 deletions(-)
New commits:
commit 55eb65ba02dc8779fa489017745cdc952a07d10c
Author: Luboš Luňák <l.lunak at collabora.com>
Date: Wed May 30 18:03:31 2018 +0200
avoid a deadlock when the crash handler can't acquire SolarMutex
Change-Id: Iea2d9b993dcf08fe022f97a2ac8e15fba9a8568c
Reviewed-on: https://gerrit.libreoffice.org/55090
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Luboš Luňák <l.lunak at collabora.com>
Reviewed-on: https://gerrit.libreoffice.org/55271
diff --git a/vcl/source/app/svmain.cxx b/vcl/source/app/svmain.cxx
index f337bc9657ce..bd7a4d6890ea 100644
--- a/vcl/source/app/svmain.cxx
+++ b/vcl/source/app/svmain.cxx
@@ -158,16 +158,18 @@ oslSignalAction VCLExceptionSignal_impl( void* /*pData*/, oslSignalInfo* pInfo)
{
bIn = true;
- SolarMutexGuard aLock;
-
- // do not stop timer because otherwise the UAE-Box will not be painted as well
- ImplSVData* pSVData = ImplGetSVData();
- if ( pSVData->mpApp )
+ vcl::SolarMutexTryAndBuyGuard aLock;
+ if( aLock.isAcquired())
{
- SystemWindowFlags nOldMode = Application::GetSystemWindowMode();
- Application::SetSystemWindowMode( nOldMode & ~SystemWindowFlags::NOAUTOMODE );
- pSVData->mpApp->Exception( nVCLException );
- Application::SetSystemWindowMode( nOldMode );
+ // do not stop timer because otherwise the UAE-Box will not be painted as well
+ ImplSVData* pSVData = ImplGetSVData();
+ if ( pSVData->mpApp )
+ {
+ SystemWindowFlags nOldMode = Application::GetSystemWindowMode();
+ Application::SetSystemWindowMode( nOldMode & ~SystemWindowFlags::NOAUTOMODE );
+ pSVData->mpApp->Exception( nVCLException );
+ Application::SetSystemWindowMode( nOldMode );
+ }
}
bIn = false;
}
commit 512d3cc11289fe3344212e73dc39bfdda846f02b
Author: Luboš Luňák <l.lunak at collabora.com>
Date: Fri May 25 13:03:28 2018 +0200
add mutex protection to more ScGlobal functions
Similarly to ScGlobal::Get(Case)Collator(), these also may be called
by multiple threads.
Change-Id: If0b1f2669282354ce79cdd251698f3aa1c6a30d4
Reviewed-on: https://gerrit.libreoffice.org/54798
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Luboš Luňák <l.lunak at collabora.com>
Reviewed-on: https://gerrit.libreoffice.org/55281
Tested-by: Luboš Luňák <l.lunak at collabora.com>
diff --git a/sc/source/core/data/global.cxx b/sc/source/core/data/global.cxx
index bf76a7085758..2c3a98622d63 100644
--- a/sc/source/core/data/global.cxx
+++ b/sc/source/core/data/global.cxx
@@ -305,18 +305,12 @@ ScAutoFormat* ScGlobal::GetOrCreateAutoFormat()
LegacyFuncCollection* ScGlobal::GetLegacyFuncCollection()
{
- assert(!bThreadedGroupCalcInProgress);
- if (!pLegacyFuncCollection)
- pLegacyFuncCollection = new LegacyFuncCollection();
- return pLegacyFuncCollection;
+ return doubleCheckedInit( pLegacyFuncCollection, []() { return new LegacyFuncCollection(); });
}
ScUnoAddInCollection* ScGlobal::GetAddInCollection()
{
- assert(!bThreadedGroupCalcInProgress);
- if (!pAddInCollection)
- pAddInCollection = new ScUnoAddInCollection();
- return pAddInCollection;
+ return doubleCheckedInit( pAddInCollection, []() { return new ScUnoAddInCollection(); });
}
ScUserList* ScGlobal::GetUserList()
@@ -1008,26 +1002,27 @@ void ScGlobal::AddLanguage( SfxItemSet& rSet, const SvNumberFormatter& rFormatte
utl::TransliterationWrapper* ScGlobal::GetpTransliteration()
{
- assert(!bThreadedGroupCalcInProgress);
- if ( !pTransliteration )
- {
- const LanguageType eOfficeLanguage = Application::GetSettings().GetLanguageTag().getLanguageType();
- pTransliteration = new ::utl::TransliterationWrapper(
- ::comphelper::getProcessComponentContext(), TransliterationFlags::IGNORE_CASE );
- pTransliteration->loadModuleIfNeeded( eOfficeLanguage );
- }
- return pTransliteration;
+ return doubleCheckedInit( pTransliteration,
+ []()
+ {
+ const LanguageType eOfficeLanguage = Application::GetSettings().GetLanguageTag().getLanguageType();
+ ::utl::TransliterationWrapper* p = new ::utl::TransliterationWrapper(
+ ::comphelper::getProcessComponentContext(), TransliterationFlags::IGNORE_CASE );
+ p->loadModuleIfNeeded( eOfficeLanguage );
+ return p;
+ });
}
::utl::TransliterationWrapper* ScGlobal::GetCaseTransliteration()
{
- assert(!bThreadedGroupCalcInProgress);
- if ( !pCaseTransliteration )
- {
- const LanguageType eOfficeLanguage = Application::GetSettings().GetLanguageTag().getLanguageType();
- pCaseTransliteration = new ::utl::TransliterationWrapper(::comphelper::getProcessComponentContext(), TransliterationFlags::NONE );
- pCaseTransliteration->loadModuleIfNeeded( eOfficeLanguage );
- }
- return pCaseTransliteration;
+ return doubleCheckedInit( pCaseTransliteration,
+ []()
+ {
+ const LanguageType eOfficeLanguage = Application::GetSettings().GetLanguageTag().getLanguageType();
+ ::utl::TransliterationWrapper* p = new ::utl::TransliterationWrapper(
+ ::comphelper::getProcessComponentContext(), TransliterationFlags::NONE );
+ p->loadModuleIfNeeded( eOfficeLanguage );
+ return p;
+ });
}
const LocaleDataWrapper* ScGlobal::GetpLocaleData()
@@ -1069,12 +1064,8 @@ CollatorWrapper* ScGlobal::GetCaseCollator()
}
css::lang::Locale* ScGlobal::GetLocale()
{
- assert(!bThreadedGroupCalcInProgress);
- if ( !pLocale )
- {
- pLocale = new css::lang::Locale( Application::GetSettings().GetLanguageTag().getLocale());
- }
- return pLocale;
+ return doubleCheckedInit( pLocale,
+ []() { return new css::lang::Locale( Application::GetSettings().GetLanguageTag().getLocale()); });
}
ScFieldEditEngine& ScGlobal::GetStaticFieldEditEngine()
More information about the Libreoffice-commits
mailing list