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

Luboš Luňák l.lunak at collabora.com
Thu May 31 20:30:23 UTC 2018


 sc/source/core/data/global.cxx |   19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

New commits:
commit e0edc647d8eb17e69f7a807c7f4cdde7b4190b61
Author: Luboš Luňák <l.lunak at collabora.com>
Date:   Fri May 25 12:29:12 2018 +0200

    assert(!bThreadedGroupCalcInProgress) in ScGlobal get-or-create functions
    
    Similarly to ScGlobal::Get(Case)Collator() these could possibly lead
    to a race condition of several singleton creations at the same time. That
    doesn't seem to be the case after few tests, but better check.
    
    Change-Id: I1edb613b5e034fcc952a43afc91f1d7288028861
    Reviewed-on: https://gerrit.libreoffice.org/54797
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Michael Meeks <michael.meeks at collabora.com>

diff --git a/sc/source/core/data/global.cxx b/sc/source/core/data/global.cxx
index 531619a101a5..0ac839200cb3 100644
--- a/sc/source/core/data/global.cxx
+++ b/sc/source/core/data/global.cxx
@@ -205,6 +205,7 @@ sal_uInt16 ScGlobal::GetStandardRowHeight()
 
 SvNumberFormatter* ScGlobal::GetEnglishFormatter()
 {
+    assert(!bThreadedGroupCalcInProgress);
     if ( !pEnglishFormatter )
     {
         pEnglishFormatter = new SvNumberFormatter(
@@ -251,6 +252,7 @@ bool ScGlobal::CheckWidthInvalidate( bool& bNumFormatChanged,
 
 const SvxSearchItem& ScGlobal::GetSearchItem()
 {
+    assert(!bThreadedGroupCalcInProgress);
     if (!pSearchItem)
     {
         pSearchItem = new SvxSearchItem( SID_SEARCH_ITEM );
@@ -261,6 +263,7 @@ const SvxSearchItem& ScGlobal::GetSearchItem()
 
 void ScGlobal::SetSearchItem( const SvxSearchItem& rNew )
 {
+    assert(!bThreadedGroupCalcInProgress);
     // FIXME: An assignment operator would be nice here
     delete pSearchItem;
     pSearchItem = static_cast<SvxSearchItem*>(rNew.Clone());
@@ -271,6 +274,7 @@ void ScGlobal::SetSearchItem( const SvxSearchItem& rNew )
 
 void ScGlobal::ClearAutoFormat()
 {
+    assert(!bThreadedGroupCalcInProgress);
     if (pAutoFormat)
     {
         //  When modified via StarOne then only the SaveLater flag is set and no saving is done.
@@ -289,6 +293,7 @@ ScAutoFormat* ScGlobal::GetAutoFormat()
 
 ScAutoFormat* ScGlobal::GetOrCreateAutoFormat()
 {
+    assert(!bThreadedGroupCalcInProgress);
     if ( !pAutoFormat )
     {
         pAutoFormat = new ScAutoFormat;
@@ -300,6 +305,7 @@ ScAutoFormat* ScGlobal::GetOrCreateAutoFormat()
 
 LegacyFuncCollection* ScGlobal::GetLegacyFuncCollection()
 {
+    assert(!bThreadedGroupCalcInProgress);
     if (!pLegacyFuncCollection)
         pLegacyFuncCollection = new LegacyFuncCollection();
     return pLegacyFuncCollection;
@@ -307,6 +313,7 @@ LegacyFuncCollection* ScGlobal::GetLegacyFuncCollection()
 
 ScUnoAddInCollection* ScGlobal::GetAddInCollection()
 {
+    assert(!bThreadedGroupCalcInProgress);
     if (!pAddInCollection)
         pAddInCollection = new ScUnoAddInCollection();
     return pAddInCollection;
@@ -314,6 +321,7 @@ ScUnoAddInCollection* ScGlobal::GetAddInCollection()
 
 ScUserList* ScGlobal::GetUserList()
 {
+    assert(!bThreadedGroupCalcInProgress);
     // Hack: Load Cfg item at the App
     global_InitAppOptions();
 
@@ -324,6 +332,7 @@ ScUserList* ScGlobal::GetUserList()
 
 void ScGlobal::SetUserList( const ScUserList* pNewList )
 {
+    assert(!bThreadedGroupCalcInProgress);
     if ( pNewList )
     {
         if ( !pUserList )
@@ -459,6 +468,7 @@ OUString ScGlobal::GetLongErrorString(FormulaError nErr)
 
 SvxBrushItem* ScGlobal::GetButtonBrushItem()
 {
+    assert(!bThreadedGroupCalcInProgress);
     pButtonBrushItem->SetColor( Application::GetSettings().GetStyleSettings().GetFaceColor() );
     return pButtonBrushItem;
 }
@@ -517,6 +527,7 @@ const OUString& ScGlobal::GetClipDocName()
 
 void ScGlobal::SetClipDocName( const OUString& rNew )
 {
+    assert(!bThreadedGroupCalcInProgress);
     *pStrClipDocName = rNew;
 }
 
@@ -658,6 +669,7 @@ bool ScGlobal::HasStarCalcFunctionList()
 
 ScFunctionList* ScGlobal::GetStarCalcFunctionList()
 {
+    assert(!bThreadedGroupCalcInProgress);
     if ( !pStarCalcFunctionList )
         pStarCalcFunctionList = new ScFunctionList;
 
@@ -666,6 +678,7 @@ ScFunctionList* ScGlobal::GetStarCalcFunctionList()
 
 ScFunctionMgr* ScGlobal::GetStarCalcFunctionMgr()
 {
+    assert(!bThreadedGroupCalcInProgress);
     if ( !pStarCalcFunctionMgr )
         pStarCalcFunctionMgr = new ScFunctionMgr;
 
@@ -681,6 +694,7 @@ void ScGlobal::ResetFunctionList()
 
 ScUnitConverter* ScGlobal::GetUnitConverter()
 {
+    assert(!bThreadedGroupCalcInProgress);
     if ( !pUnitConverter )
         pUnitConverter = new ScUnitConverter;
 
@@ -994,6 +1008,7 @@ void ScGlobal::AddLanguage( SfxItemSet& rSet, const SvNumberFormatter& rFormatte
 
 utl::TransliterationWrapper* ScGlobal::GetpTransliteration()
 {
+    assert(!bThreadedGroupCalcInProgress);
     if ( !pTransliteration )
     {
         const LanguageType eOfficeLanguage = Application::GetSettings().GetLanguageTag().getLanguageType();
@@ -1016,6 +1031,7 @@ const LocaleDataWrapper* ScGlobal::GetpLocaleData()
 }
 CalendarWrapper*     ScGlobal::GetCalendar()
 {
+    assert(!bThreadedGroupCalcInProgress);
     if ( !pCalendar )
     {
         pCalendar = new CalendarWrapper( ::comphelper::getProcessComponentContext() );
@@ -1045,6 +1061,7 @@ CollatorWrapper*        ScGlobal::GetCaseCollator()
 }
 ::utl::TransliterationWrapper* ScGlobal::GetCaseTransliteration()
 {
+    assert(!bThreadedGroupCalcInProgress);
     if ( !pCaseTransliteration )
     {
         const LanguageType eOfficeLanguage = Application::GetSettings().GetLanguageTag().getLanguageType();
@@ -1055,6 +1072,7 @@ CollatorWrapper*        ScGlobal::GetCaseCollator()
 }
 css::lang::Locale*     ScGlobal::GetLocale()
 {
+    assert(!bThreadedGroupCalcInProgress);
     if ( !pLocale )
     {
         pLocale = new css::lang::Locale( Application::GetSettings().GetLanguageTag().getLocale());
@@ -1064,6 +1082,7 @@ css::lang::Locale*     ScGlobal::GetLocale()
 
 ScFieldEditEngine& ScGlobal::GetStaticFieldEditEngine()
 {
+    assert(!bThreadedGroupCalcInProgress);
     if (!pFieldEditEngine)
     {
         // Creating a ScFieldEditEngine with pDocument=NULL leads to document


More information about the Libreoffice-commits mailing list