Kaydet (Commit) e2b11f4f authored tarafından Kohei Yoshida's avatar Kohei Yoshida

Prevent excessive references to single token instance during fill.

Because if not, we may run out of the 16-bit integer space to store
reference count.
üst 400f715a
......@@ -535,6 +535,8 @@ public:
bool IsMultilineResult();
void MaybeInterpret();
void ResetFormulaResult();
};
// Iterator for references in a formula cell
......
......@@ -117,6 +117,8 @@ public:
mpToken->DecRef();
}
inline void Reset();
/** Well, guess what ... */
inline ScFormulaResult & operator=( const ScFormulaResult & r );
......@@ -216,6 +218,16 @@ public:
inline ScMatrixFormulaCellToken* GetMatrixFormulaCellTokenNonConst();
};
inline void ScFormulaResult::Reset()
{
ResetToDefaults();
if (mbToken && mpToken)
mpToken->DecRef();
mbToken = true;
mpToken = NULL;
}
inline void ScFormulaResult::ResetToDefaults()
{
......
......@@ -2041,6 +2041,11 @@ void ScFormulaCell::MaybeInterpret()
Interpret();
}
void ScFormulaCell::ResetFormulaResult()
{
aResult.Reset();
}
EditTextObject* ScFormulaCell::CreateURLObject()
{
String aCellText;
......
......@@ -429,6 +429,7 @@ void ScTable::FillFormula(sal_uLong& /* nFormulaCounter */, bool /* bFirst */, S
pDocument->SetNoListening( true ); // noch falsche Referenzen
ScAddress aAddr( nDestCol, nDestRow, nTab );
ScFormulaCell* pDestCell = new ScFormulaCell( *pSrcCell, *pDocument, aAddr );
pDestCell->ResetFormulaResult(); // formula cell is interpreted later during fill.
aCol[nDestCol].Insert(nDestRow, pDestCell);
if ( bLast && pDestCell->GetMatrixFlag() )
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment