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

Tor Lillqvist tml at collabora.com
Tue Sep 12 07:49:10 UTC 2017


 sc/source/core/data/formulacell.cxx |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit 2652ce62f2ed4259e95578bc24af52fc48f197d5
Author: Tor Lillqvist <tml at collabora.com>
Date:   Wed Aug 16 12:43:37 2017 +0300

    Make two slightly mysterious static local variables thread_local
    
    IRC discussion about them:
    
    tml_: erAck: any idea why in ScFormulaCell::GetMatrixEdge those nC and
    nR are static?
    
    tml_: seems to have been since initial import in 2000 (then in a
    different file, and of type USHORT)
    
    tml_: let's assume it is just random insanity
    
    tml_: hmm, no, making them non-static actually breaks a unit test. wow
    
    erAck: tml_: they are reused when the call is for the same matrix
    origin as the last one to not have to recalculate the same thing
    
    tml_: erAck: ah ok
    
    Change-Id: Ib0fe322492917b5224937ec6ef527707ca2e07f7
    Reviewed-on: https://gerrit.libreoffice.org/41658
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Eike Rathke <erack at redhat.com>

diff --git a/sc/source/core/data/formulacell.cxx b/sc/source/core/data/formulacell.cxx
index 82c5f970e911..22ef81ca2495 100644
--- a/sc/source/core/data/formulacell.cxx
+++ b/sc/source/core/data/formulacell.cxx
@@ -2658,8 +2658,8 @@ sc::MatrixEdge ScFormulaCell::GetMatrixEdge( ScAddress& rOrgPos ) const
         case ScMatrixMode::Formula :
         case ScMatrixMode::Reference :
         {
-            static SCCOL nC;
-            static SCROW nR;
+            static thread_local SCCOL nC;
+            static thread_local SCROW nR;
             ScAddress aOrg;
             if ( !GetMatrixOrigin( aOrg ) )
                 return sc::MatrixEdge::Nothing;


More information about the Libreoffice-commits mailing list