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@libreoffice.org>
Reviewed-by: Eike Rathke <erack@redhat.com>
diff --git a/sc/source/core/data/formulacell.cxx b/sc/source/core/data/formulacell.cxx
index 82c5f97..22ef81c 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;