sc/inc/dociter.hxx               |    6 ++----
 sc/qa/unit/ucalc.cxx             |    4 +++-
 sc/source/core/data/dociter.cxx  |    8 ++++----
 sc/source/core/tool/interpr1.cxx |   16 +++++++---------
 sc/source/core/tool/interpr2.cxx |    4 ++--
 sc/source/core/tool/interpr3.cxx |   16 ++++++++--------
 sc/source/core/tool/interpr5.cxx |    4 ++--
 sc/source/core/tool/interpr6.cxx |    3 +--
 8 files changed, 29 insertions(+), 32 deletions(-)

New commits:
commit 0e263244f13f1dd0586ca4f262dae84e515b35da
Author:     Caolán McNamara <[email protected]>
AuthorDate: Thu Sep 8 10:10:10 2022 +0100
Commit:     Eike Rathke <[email protected]>
CommitDate: Sun Sep 11 00:24:23 2022 +0200

    crashtesting: threaded assert on loading forum-de3-3100.ods
    
    use SetInterpreterContext like I see in similar places to avoid the need
    to call ScDocument::GetFormatTable
    
     #9  0x00007fd35b1af283 in ScDocument::GetFormatTable() const 
(this=this@entry=0x5573153bf1d0) at sc/source/core/data/documen2.cxx:463
             __PRETTY_FUNCTION__ = "SvNumberFormatter* 
ScDocument::GetFormatTable() const"
     #10 0x00007fd35b196f57 in ScAttrArray_IterGetNumberFormat(sal_uInt32&, 
ScAttrArray const*&, SCROW&, ScAttrArray const*, SCROW, ScDocument const&, 
ScInterpreterContext const*) (nFormat=@0x7fd354458b38: 0, 
rpArr=@0x7fd354458b30: 0x0, nAttrEndRow=@0x7fd354458b54: 0, 
pNewArr=0x557315063910, nRow=nRow@entry=30, rDoc=..., pContext=0x0) at 
sc/source/core/data/dociter.cxx:80
             nRowStart = 30
             nRowEnd = 30
             pPattern = 0x557316c093f0
     #11 0x00007fd35b19e5b7 in ScValueIterator::GetThis(double&, FormulaError&) 
(this=this@entry=0x7fd354458b20, rValue=@0x7fd354458b00: 0, 
rErr=@0x7fd354458af8: FormulaError::NONE) at sc/source/core/data/dociter.cxx:196
             bNextColumn = <optimized out>
             pCol = 0x557316aca050
             nCurRow = 30
            nLastRow = 32723
     #12 0x00007fd35b19e8c4 in ScValueIterator::GetNext(double&, FormulaError&) 
(this=<optimized out>, this@entry=0x7fd354458b20, rValue=@0x7fd354458b00: 0, 
rErr=@0x7fd354458af8: FormulaError::NONE) at sc/source/core/data/dociter.cxx:297
     #13 0x00007fd35b6a5307 in ScInterpreter::GetNumberSequenceArray(unsigned 
char, std::__debug::vector<double, std::allocator<double> >&, bool) 
(this=this@entry=0x5573169d9900, nParamCount=nParamCount@entry=1 '\001', 
rArray=std::__debug::vector of length 2, capacity 200 = {...}, 
bConvertTextInArray=bConvertTextInArray@entry=false) at 
sc/source/core/tool/interpr3.cxx:3986
             nCellCount = <optimized out>
             nErr = FormulaError::NONE
             fCellVal = 0
             aValIter = {mrDoc = @0x5573153bf1d0, pContext = 0x0, pAttrArray = 
0x0, nNumFormat = 0, nNumFmtIndex = 0, maStartPos = {nRow = 0, nCol = 0, nTab = 
4, static detailsOOOa1 = {eConv = formula::FormulaGrammar::CONV_OOO, nRow = 0, 
nCol = 0}}, maEndPos = {nRow = 199, nCol = 0, nTab = 4, static detailsOOOa1 = 
{eConv = formula::FormulaGrammar::CONV_OOO, nRow = 0, nCol = 0}}, mnCol = 0, 
mnTab = 4, nAttrEndRow = 0, mnSubTotalFlags = SubtotalFlags::NONE, nNumFmtType 
= SvNumFormatType::UNDEFINED, bNumValid = false, bCalcAsShown = true, 
bTextAsZero = false, mpCells = 0x557316aca280, maCurPos = {first = 
{<mdds::mtv::soa::detail::iterator_updater<mdds::mtv::soa::multi_type_vector<mdds::mtv::custom_block_func3<mdds::mtv::default_element_block<52,
 svl::SharedString>, mdds::mtv::noncopyable_managed_element_block<53, 
EditTextObject>, mdds::mtv::noncopyable_managed_element_block<54, 
ScFormulaCell> >, sc::CellStoreTrait>::const_iterator_trait>> = {m_cur_node = 
{type = 10, position = 30, size 
 = 1, data = 0x557316d734d0, __private_data = {parent = 0x557316aca280, 
block_index = 1}}, m_pos = {position_iterator = 30, size_iterator = 1, 
element_block_iterator = 0x557316d734d0}, m_end = {position_iterator = 
7378697629483820646, size_iterator = 7378697629483820646, 
element_block_iterator = 0x6666666666666666}}, <No data fields>}, second = 0}}
             eStackType = <optimized out>
             aAdr = {nRow = 0, nCol = 0, nTab = 0, static detailsOOOa1 = {eConv 
= formula::FormulaGrammar::CONV_OOO, nRow = 0, nCol = 0}}
             aRange = {aStart = {nRow = 0, nCol = 0, nTab = 4, static 
detailsOOOa1 = {eConv = formula::FormulaGrammar::CONV_OOO, nRow = 0, nCol = 
0}}, aEnd = {nRow = 199, nCol = 0, nTab = 4, static detailsOOOa1 = {eConv = 
formula::FormulaGrammar::CONV_OOO, nRow = 0, nCol = 0}}}
             bIgnoreErrVal = false
             nParam = 0
             nRefInList = 0
     #14 0x00007fd35b6aa9ed in ScInterpreter::CalculateSmallLarge(bool) 
(this=this@entry=0x5573169d9900, bSmall=bSmall@entry=true) at 
sc/source/core/tool/interpr3.cxx:3657
             nCol = 1
             nRow = 1
             aArray = std::__debug::vector of length 1, capacity 1 = {1}
             nRankArraySize = 1
             __PRETTY_FUNCTION__ = "void 
ScInterpreter::CalculateSmallLarge(bool)"
             aRankArray = std::__debug::vector of length 1, capacity 1 = {1}
             aSortArray = std::__debug::vector of length 2, capacity 200 = {1, 
21}
             nSize = <optimized out>
     #15 0x00007fd35b6abac8 in ScInterpreter::ScSmall() 
(this=this@entry=0x5573169d9900) at sc/source/core/tool/interpr3.cxx:3717
     #16 0x00007fd35b6cd929 in ScInterpreter::Interpret() 
(this=this@entry=0x5573169d9900) at sc/source/core/tool/interpr4.cxx:4373
             bGotResult = <optimized out>
             nRetTypeExpr = SvNumFormatType::NUMBER
             nRetIndexExpr = 0
             nErrorFunction = 0
             nErrorFunctionCount = 0
             aErrorFunctionStack = std::__debug::vector of length 0, capacity 0
             nStackBase = 0
             aTokenMatrixMapIter = Python Exception <class 'AttributeError'> 
'NoneType' object has no attribute 'pointer':
     {_M_node = 0x5573169d99c8}
             eOp = ocSmall
             __PRETTY_FUNCTION__ = "formula::StackVar 
ScInterpreter::Interpret()"
             bForcedResultType = <optimized out>
             p = <optimized out>
             eType = <optimized out>
     #17 0x00007fd35b3c6ed1 in 
ScFormulaCell::InterpretTail(ScInterpreterContext&, 
ScFormulaCell::ScInterpretTailParameter) (this=0x55731309d8f0, rContext=..., 
eTailParam=eTailParam@entry=ScFormulaCell::SCITP_NORMAL) at 
sc/source/core/data/formulacell.cxx:1945
             pScopedInterpreter = std::unique_ptr<class ScInterpreter> = {get() 
= 0x0}
             pInterpreter = 0x5573169d9900
             nOldErrCode = FormulaError::NONE
             bContentChanged = <optimized out>
             aNewResult = {static MULTILINE_UNKNOWN = 0 '\000', static 
MULTILINE_FALSE = 1 '\001', static MULTILINE_TRUE = 2 '\002', {mfValue = 
6.9438766800236802e-310, mpToken = 0x7fd3544591e8}, mbToken = false, mbEmpty = 
false, mbEmptyDisplayedAsString = false, mbValueCached = true, meMultiline = 3 
'\003', mnError = 28442}
             bOldRunning = false
             bForceNumberFormat = <optimized out>
             aRecursionCounter = {rRec = @0x557316da2b40, bStackedInIteration = 
false, cell = 0x55731309d8f0}
     #18 0x00007fd35b0c84cb in 
ScColumn::CalculateInThread(ScInterpreterContext&, int, unsigned long, unsigned 
long, unsigned int, unsigned int) (this=<optimized out>, rContext=..., 
nRow=nRow@entry=0, nLen=nLen@entry=30, nOffset=nOffset@entry=0, 
nThisThread=nThisThread@entry=0, nThreadsTotal=48) at 
sc/source/core/data/column2.cxx:3218
    
    always pass ScInterpreterContext to ScValueIterator
    
    its available at every call site
    
    Change-Id: Ifeddbfda8afe47c3754ed1fcab836dfd2c8f38ca
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139636
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <[email protected]>
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139741
    Reviewed-by: Eike Rathke <[email protected]>

diff --git a/sc/inc/dociter.hxx b/sc/inc/dociter.hxx
index 90fbd614b8bd..274149806d16 100644
--- a/sc/inc/dociter.hxx
+++ b/sc/inc/dociter.hxx
@@ -53,7 +53,7 @@ class ScValueIterator            // walk through all values 
in an area
     typedef sc::CellStoreType::const_position_type PositionType;
 
     ScDocument&     mrDoc;
-    ScInterpreterContext* pContext;
+    ScInterpreterContext& mrContext;
     const ScAttrArray*  pAttrArray;
     sal_uInt32      nNumFormat;     // for CalcAsShown
     sal_uInt32      nNumFmtIndex;
@@ -83,7 +83,7 @@ class ScValueIterator            // walk through all values 
in an area
 
 public:
 
-    ScValueIterator(
+    ScValueIterator(ScInterpreterContext& rContext,
         ScDocument& rDocument, const ScRange& rRange, SubtotalFlags 
nSubTotalFlags = SubtotalFlags::NONE,
         bool bTextAsZero = false );
 
@@ -94,8 +94,6 @@ public:
 
     /// Does NOT reset rValue if no value found!
     bool GetNext( double& rValue, FormulaError& rErr );
-
-    void SetInterpreterContext( ScInterpreterContext* context ) { pContext = 
context; }
 };
 
 class ScDBQueryDataIterator
diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx
index a83b5482647f..db371c46ddc8 100644
--- a/sc/qa/unit/ucalc.cxx
+++ b/sc/qa/unit/ucalc.cxx
@@ -1349,6 +1349,8 @@ void Test::testValueIterator()
     aOpt.SetCalcAsShown(true);
     m_pDoc->SetDocOptions(aOpt);
 
+    ScInterpreterContext aContext(*m_pDoc, m_pDoc->GetFormatTable());
+
     // Purely horizontal data layout with numeric data.
     for (SCCOL i = 1; i <= 3; ++i)
         m_pDoc->SetValue(ScAddress(i,2,0), i);
@@ -1356,7 +1358,7 @@ void Test::testValueIterator()
     {
         const double aChecks[] = { 1.0, 2.0, 3.0 };
         size_t const nCheckLen = SAL_N_ELEMENTS(aChecks);
-        ScValueIterator aIter(*m_pDoc, ScRange(1,2,0,3,2,0));
+        ScValueIterator aIter(aContext, *m_pDoc, ScRange(1,2,0,3,2,0));
         bool bHas = false;
         size_t nCheckPos = 0;
         double fVal;
diff --git a/sc/source/core/data/dociter.cxx b/sc/source/core/data/dociter.cxx
index c11ca75f05e2..38a4a218e3c8 100644
--- a/sc/source/core/data/dociter.cxx
+++ b/sc/source/core/data/dociter.cxx
@@ -82,10 +82,10 @@ static void ScAttrArray_IterGetNumberFormat( sal_uInt32& 
nFormat, const ScAttrAr
     nAttrEndRow = nRowEnd;
 }
 
-ScValueIterator::ScValueIterator( ScDocument& rDocument, const ScRange& rRange,
+ScValueIterator::ScValueIterator(ScInterpreterContext& rContext, ScDocument& 
rDocument, const ScRange& rRange,
             SubtotalFlags nSubTotalFlags, bool bTextZero )
     : mrDoc(rDocument)
-    , pContext(nullptr)
+    , mrContext(rContext)
     , pAttrArray(nullptr)
     , nNumFormat(0) // Initialized in GetNumberFormat
     , nNumFmtIndex(0)
@@ -194,8 +194,8 @@ bool ScValueIterator::GetThis(double& rValue, FormulaError& 
rErr)
                 if (bCalcAsShown)
                 {
                     ScAttrArray_IterGetNumberFormat(nNumFormat, pAttrArray,
-                        nAttrEndRow, pCol->pAttrArray.get(), nCurRow, mrDoc, 
pContext);
-                    rValue = mrDoc.RoundValueAsShown(rValue, nNumFormat, 
pContext);
+                        nAttrEndRow, pCol->pAttrArray.get(), nCurRow, mrDoc, 
&mrContext);
+                    rValue = mrDoc.RoundValueAsShown(rValue, nNumFormat, 
&mrContext);
                 }
                 return true; // Found it!
             }
diff --git a/sc/source/core/tool/interpr1.cxx b/sc/source/core/tool/interpr1.cxx
index 0fd78f8b1a99..bfb897590070 100644
--- a/sc/source/core/tool/interpr1.cxx
+++ b/sc/source/core/tool/interpr1.cxx
@@ -1314,7 +1314,7 @@ void ScInterpreter::ScAnd()
                     {
                         double fVal;
                         FormulaError nErr = FormulaError::NONE;
-                        ScValueIterator aValIter( mrDoc, aRange );
+                        ScValueIterator aValIter( mrContext, mrDoc, aRange );
                         if ( aValIter.GetFirst( fVal, nErr ) && nErr == 
FormulaError::NONE )
                         {
                             bHaveValue = true;
@@ -1412,7 +1412,7 @@ void ScInterpreter::ScOr()
                     {
                         double fVal;
                         FormulaError nErr = FormulaError::NONE;
-                        ScValueIterator aValIter( mrDoc, aRange );
+                        ScValueIterator aValIter( mrContext, mrDoc, aRange );
                         if ( aValIter.GetFirst( fVal, nErr ) )
                         {
                             bHaveValue = true;
@@ -1514,7 +1514,7 @@ void ScInterpreter::ScXor()
                     {
                         double fVal;
                         FormulaError nErr = FormulaError::NONE;
-                        ScValueIterator aValIter( mrDoc, aRange );
+                        ScValueIterator aValIter( mrContext, mrDoc, aRange );
                         if ( aValIter.GetFirst( fVal, nErr ) )
                         {
                             bHaveValue = true;
@@ -3692,8 +3692,7 @@ void ScInterpreter::ScMin( bool bTextAsZero )
             {
                 FormulaError nErr = FormulaError::NONE;
                 PopDoubleRef( aRange, nParamCount, nRefInList);
-                ScValueIterator aValIter( mrDoc, aRange, mnSubTotalFlags, 
bTextAsZero );
-                aValIter.SetInterpreterContext( &mrContext );
+                ScValueIterator aValIter( mrContext, mrDoc, aRange, 
mnSubTotalFlags, bTextAsZero );
                 if (aValIter.GetFirst(nVal, nErr))
                 {
                     if (nMin > nVal)
@@ -3850,8 +3849,7 @@ void ScInterpreter::ScMax( bool bTextAsZero )
             {
                 FormulaError nErr = FormulaError::NONE;
                 PopDoubleRef( aRange, nParamCount, nRefInList);
-                ScValueIterator aValIter( mrDoc, aRange, mnSubTotalFlags, 
bTextAsZero );
-                aValIter.SetInterpreterContext( &mrContext );
+                ScValueIterator aValIter( mrContext, mrDoc, aRange, 
mnSubTotalFlags, bTextAsZero );
                 if (aValIter.GetFirst(nVal, nErr))
                 {
                     if (nMax < nVal)
@@ -4027,7 +4025,7 @@ void ScInterpreter::GetStVarParams( bool bTextAsZero, 
double(*VarResult)( double
                     ArrayRefListValue& rArrayValue = 
vArrayValues[nRefArrayPos];
                     FormulaError nErr = FormulaError::NONE;
                     PopDoubleRef( aRange, nParamCount, nRefInList);
-                    ScValueIterator aValIter( mrDoc, aRange, mnSubTotalFlags, 
bTextAsZero );
+                    ScValueIterator aValIter( mrContext, mrDoc, aRange, 
mnSubTotalFlags, bTextAsZero );
                     if (aValIter.GetFirst(fVal, nErr))
                     {
                         do
@@ -4052,7 +4050,7 @@ void ScInterpreter::GetStVarParams( bool bTextAsZero, 
double(*VarResult)( double
             {
                 FormulaError nErr = FormulaError::NONE;
                 PopDoubleRef( aRange, nParamCount, nRefInList);
-                ScValueIterator aValIter( mrDoc, aRange, mnSubTotalFlags, 
bTextAsZero );
+                ScValueIterator aValIter( mrContext, mrDoc, aRange, 
mnSubTotalFlags, bTextAsZero );
                 if (aValIter.GetFirst(fVal, nErr))
                 {
                     do
diff --git a/sc/source/core/tool/interpr2.cxx b/sc/source/core/tool/interpr2.cxx
index 67fcd9f787f8..a417c9d4ba74 100644
--- a/sc/source/core/tool/interpr2.cxx
+++ b/sc/source/core/tool/interpr2.cxx
@@ -1445,7 +1445,7 @@ void ScInterpreter::ScIRR()
         }
         else
         {
-            ScValueIterator aValIter(mrDoc, aRange, mnSubTotalFlags);
+            ScValueIterator aValIter(mrContext, mrDoc, aRange, 
mnSubTotalFlags);
             bool bLoop = aValIter.GetFirst(fValue, nIterError);
             while (bLoop && nIterError == FormulaError::NONE)
             {
@@ -1553,7 +1553,7 @@ void ScInterpreter::ScMIRR()
         }
         else
         {
-            ScValueIterator aValIter( mrDoc, aRange, mnSubTotalFlags );
+            ScValueIterator aValIter( mrContext, mrDoc, aRange, 
mnSubTotalFlags );
             double fCellValue;
             FormulaError nIterError = FormulaError::NONE;
 
diff --git a/sc/source/core/tool/interpr3.cxx b/sc/source/core/tool/interpr3.cxx
index e5ae61962014..c0ac25b257e5 100644
--- a/sc/source/core/tool/interpr3.cxx
+++ b/sc/source/core/tool/interpr3.cxx
@@ -2505,7 +2505,7 @@ void ScInterpreter::ScZTest()
                 ScRange aRange;
                 FormulaError nErr = FormulaError::NONE;
                 PopDoubleRef( aRange, nParam, nRefInList);
-                ScValueIterator aValIter( mrDoc, aRange, mnSubTotalFlags );
+                ScValueIterator aValIter( mrContext, mrDoc, aRange, 
mnSubTotalFlags );
                 if (aValIter.GetFirst(fVal, nErr))
                 {
                     fSum += fVal;
@@ -2947,7 +2947,7 @@ void ScInterpreter::ScHarMean()
                 FormulaError nErr = FormulaError::NONE;
                 PopDoubleRef( aRange, nParamCount, nRefInList);
                 double nCellVal;
-                ScValueIterator aValIter( mrDoc, aRange, mnSubTotalFlags );
+                ScValueIterator aValIter( mrContext, mrDoc, aRange, 
mnSubTotalFlags );
                 if (aValIter.GetFirst(nCellVal, nErr))
                 {
                     if (nCellVal > 0.0)
@@ -3085,7 +3085,7 @@ void ScInterpreter::ScGeoMean()
                 FormulaError nErr = FormulaError::NONE;
                 PopDoubleRef( aRange, nParamCount, nRefInList);
                 double nCellVal;
-                ScValueIterator aValIter(mrDoc, aRange, mnSubTotalFlags);
+                ScValueIterator aValIter(mrContext, mrDoc, aRange, 
mnSubTotalFlags);
                 if (aValIter.GetFirst(nCellVal, nErr))
                 {
                     if (nCellVal > 0.0)
@@ -3250,7 +3250,7 @@ bool ScInterpreter::CalculateSkew(KahanSum& fSum, double& 
fCount, std::vector<do
             {
                 PopDoubleRef( aRange, nParamCount, nRefInList);
                 FormulaError nErr = FormulaError::NONE;
-                ScValueIterator aValIter( mrDoc, aRange, mnSubTotalFlags );
+                ScValueIterator aValIter( mrContext, mrDoc, aRange, 
mnSubTotalFlags );
                 if (aValIter.GetFirst(fVal, nErr))
                 {
                     fSum += fVal;
@@ -3885,7 +3885,7 @@ std::vector<double> ScInterpreter::GetTopNumberArray( 
SCSIZE& rCol, SCSIZE& rRow
 
             FormulaError nErr = FormulaError::NONE;
             double fCellVal;
-            ScValueIterator aValIter(mrDoc, aRange, mnSubTotalFlags);
+            ScValueIterator aValIter(mrContext, mrDoc, aRange, 
mnSubTotalFlags);
             if (aValIter.GetFirst(fCellVal, nErr))
             {
                 do
@@ -3966,7 +3966,7 @@ void ScInterpreter::GetNumberSequenceArray( sal_uInt8 
nParamCount, vector<double
 
                 FormulaError nErr = FormulaError::NONE;
                 double fCellVal;
-                ScValueIterator aValIter( mrDoc, aRange, mnSubTotalFlags );
+                ScValueIterator aValIter( mrContext, mrDoc, aRange, 
mnSubTotalFlags );
                 if (aValIter.GetFirst( fCellVal, nErr))
                 {
                     if (bIgnoreErrVal)
@@ -4304,7 +4304,7 @@ void ScInterpreter::ScAveDev()
                 FormulaError nErr = FormulaError::NONE;
                 double nCellVal;
                 PopDoubleRef( aRange, nParam, nRefInList);
-                ScValueIterator aValIter( mrDoc, aRange, mnSubTotalFlags );
+                ScValueIterator aValIter( mrContext, mrDoc, aRange, 
mnSubTotalFlags );
                 if (aValIter.GetFirst(nCellVal, nErr))
                 {
                     rVal += nCellVal;
@@ -4383,7 +4383,7 @@ void ScInterpreter::ScAveDev()
                 FormulaError nErr = FormulaError::NONE;
                 double nCellVal;
                 PopDoubleRef( aRange, nParam, nRefInList);
-                ScValueIterator aValIter( mrDoc, aRange, mnSubTotalFlags );
+                ScValueIterator aValIter( mrContext, mrDoc, aRange, 
mnSubTotalFlags );
                 if (aValIter.GetFirst(nCellVal, nErr))
                 {
                     rVal += std::abs(nCellVal - nMiddle);
diff --git a/sc/source/core/tool/interpr5.cxx b/sc/source/core/tool/interpr5.cxx
index fc192bfbdbd9..aa445079fe15 100644
--- a/sc/source/core/tool/interpr5.cxx
+++ b/sc/source/core/tool/interpr5.cxx
@@ -158,7 +158,7 @@ void ScInterpreter::ScGCD()
                 FormulaError nErr = FormulaError::NONE;
                 PopDoubleRef( aRange, nParamCount, nRefInList);
                 double nCellVal;
-                ScValueIterator aValIter( mrDoc, aRange, mnSubTotalFlags );
+                ScValueIterator aValIter( mrContext, mrDoc, aRange, 
mnSubTotalFlags );
                 if (aValIter.GetFirst(nCellVal, nErr))
                 {
                     do
@@ -235,7 +235,7 @@ void ScInterpreter:: ScLCM()
                 FormulaError nErr = FormulaError::NONE;
                 PopDoubleRef( aRange, nParamCount, nRefInList);
                 double nCellVal;
-                ScValueIterator aValIter( mrDoc, aRange, mnSubTotalFlags );
+                ScValueIterator aValIter( mrContext, mrDoc, aRange, 
mnSubTotalFlags );
                 if (aValIter.GetFirst(nCellVal, nErr))
                 {
                     do
diff --git a/sc/source/core/tool/interpr6.cxx b/sc/source/core/tool/interpr6.cxx
index 0d80a8842566..545bbd58c444 100644
--- a/sc/source/core/tool/interpr6.cxx
+++ b/sc/source/core/tool/interpr6.cxx
@@ -783,8 +783,7 @@ void ScInterpreter::IterateParameters( ScIterFunc eFunc, 
bool bTextAsZero )
                 }
                 else
                 {
-                    ScValueIterator aValIter( mrDoc, aRange, mnSubTotalFlags, 
bTextAsZero );
-                    aValIter.SetInterpreterContext( &mrContext );
+                    ScValueIterator aValIter( mrContext, mrDoc, aRange, 
mnSubTotalFlags, bTextAsZero );
                     FormulaError nErr = FormulaError::NONE;
                     if (aValIter.GetFirst(fVal, nErr))
                     {

Reply via email to