chart2/source/model/main/PageBackground.cxx |    6 +++---
 svl/source/numbers/zforlist.cxx             |   19 +++++--------------
 2 files changed, 8 insertions(+), 17 deletions(-)

New commits:
commit 4edcd840aef4d1b594beecb44a0edbc0cdf5e5aa
Author:     Caolán McNamara <caolan.mcnam...@collabora.com>
AuthorDate: Thu Feb 29 09:39:02 2024 +0000
Commit:     Caolán McNamara <caolan.mcnam...@collabora.com>
CommitDate: Fri Mar 1 10:39:06 2024 +0100

    set default if no ViewShell yet
    
    Change-Id: Ib6381ec963a9dc641d880eef1f9a3e556100a98e
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164142
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caolan.mcnam...@collabora.com>

diff --git a/chart2/source/model/main/PageBackground.cxx 
b/chart2/source/model/main/PageBackground.cxx
index b4c21df55fb4..deae689d7a2b 100644
--- a/chart2/source/model/main/PageBackground.cxx
+++ b/chart2/source/model/main/PageBackground.cxx
@@ -55,10 +55,10 @@ const ::chart::tPropertyValueMap& 
StaticPageBackgroundDefaults()
             if (comphelper::LibreOfficeKit::isActive()) {
                 aDocColor = COL_AUTO;
             } else {
-                if (SfxViewShell::Current()) {
-                    aDocColor = 
SfxViewShell::Current()->GetColorConfigColor(svtools::DOCCOLOR);
+                if (SfxViewShell* pCurrentSh = SfxViewShell::Current()) {
+                    aDocColor = 
pCurrentSh->GetColorConfigColor(svtools::DOCCOLOR);
                 } else {
-                    SAL_WARN("chart2", "SfxViewShell::Current() returned 
nullptr");
+                    aDocColor = 
svtools::ColorConfig().GetColorValue(svtools::DOCCOLOR).nColor;
                 }
             }
             ::chart::PropertyHelper::setPropertyValue( aTmp, 
::chart::FillProperties::PROP_FILL_COLOR, aDocColor );
commit bc08b1fbbd00c6e4b086f6d95249e684ace6ae25
Author:     Caolán McNamara <caolan.mcnam...@collabora.com>
AuthorDate: Thu Feb 29 20:01:26 2024 +0000
Commit:     Caolán McNamara <caolan.mcnam...@collabora.com>
CommitDate: Fri Mar 1 10:38:56 2024 +0100

    scope of MutexGuard can be reduced
    
    These are just locals, except for IniLnge which is set once in the
    ctor and is then immutable
    
    Change-Id: I0d8ac0c3ca729003a3575dea39b2746dfc53b4bc
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164173
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caolan.mcnam...@collabora.com>

diff --git a/svl/source/numbers/zforlist.cxx b/svl/source/numbers/zforlist.cxx
index bdc431efcbdf..c1a3fcb9015d 100644
--- a/svl/source/numbers/zforlist.cxx
+++ b/svl/source/numbers/zforlist.cxx
@@ -3530,33 +3530,25 @@ SvNumberFormatterMergeMap 
SvNumberFormatter::ConvertMergeTableToMap()
     return aMap;
 }
 
-
 sal_uInt32 SvNumberFormatter::GetFormatForLanguageIfBuiltIn( sal_uInt32 
nFormat,
                                                              LanguageType 
eLnge )
 {
-    ::osl::MutexGuard aGuard( GetInstanceMutex() );
     if ( eLnge == LANGUAGE_DONTKNOW )
-    {
-        eLnge = IniLnge;
-    }
+        eLnge = IniLnge;    // IniLnge never changes
     if ( nFormat < SV_COUNTRY_LANGUAGE_OFFSET && eLnge == IniLnge )
-    {
         return nFormat;     // it stays as it is
-    }
     sal_uInt32 nOffset = nFormat % SV_COUNTRY_LANGUAGE_OFFSET;  // relative 
index
     if ( nOffset > SV_MAX_COUNT_STANDARD_FORMATS )
-    {
-        return nFormat;    // not a built-in format
-    }
+        return nFormat;     // not a built-in format
+
+    ::osl::MutexGuard aGuard( GetInstanceMutex() );
     sal_uInt32 nCLOffset = ImpGenerateCL(eLnge);    // create new standard 
formats if necessary
     return nCLOffset + nOffset;
 }
 
-
 sal_uInt32 SvNumberFormatter::GetFormatIndex( NfIndexTableOffset nTabOff,
                                               LanguageType eLnge )
 {
-    ::osl::MutexGuard aGuard( GetInstanceMutex() );
     if (nTabOff >= NF_INDEX_TABLE_ENTRIES)
         return NUMBERFORMAT_ENTRY_NOT_FOUND;
 
@@ -3566,12 +3558,11 @@ sal_uInt32 SvNumberFormatter::GetFormatIndex( 
NfIndexTableOffset nTabOff,
     if (indexTable[nTabOff] == NUMBERFORMAT_ENTRY_NOT_FOUND)
         return NUMBERFORMAT_ENTRY_NOT_FOUND;
 
+    ::osl::MutexGuard aGuard( GetInstanceMutex() );
     sal_uInt32 nCLOffset = ImpGenerateCL(eLnge);    // create new standard 
formats if necessary
-
     return nCLOffset + indexTable[nTabOff];
 }
 
-
 NfIndexTableOffset SvNumberFormatter::GetIndexTableOffset( sal_uInt32 nFormat 
) const
 {
     sal_uInt32 nOffset = nFormat % SV_COUNTRY_LANGUAGE_OFFSET;      // 
relative index

Reply via email to