diff options
author | Eike Rathke <erack@redhat.com> | 2016-03-16 23:03:58 +0100 |
---|---|---|
committer | Eike Rathke <erack@redhat.com> | 2016-03-17 11:38:29 +0100 |
commit | 336d816176650726f6d14539464d9fd28ddd032d (patch) | |
tree | 1212c0dbab74ec6ef2b691d5030ab928712db114 /sc | |
parent | 2a78e3eb92466ede9ea8fd3c3632c286fbd915a2 (diff) |
ensure a correct index is assigned to a duplicated ScRangeData instance
ScRangeName::insert() assigns an index only if the passed ScRangeData
instance's index was 0. Duplicating an ScRangeData object duplicates
also the index, so effectively two instances with the same index could
be inserted to the named expressions collection, a following
ScRangeName::findByIndex() retrieved one of them by chance.
Change-Id: Ic141ffb1a683bda5907f4359167da84faf1649e1
Diffstat (limited to 'sc')
-rw-r--r-- | sc/source/core/data/formulacell.cxx | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/sc/source/core/data/formulacell.cxx b/sc/source/core/data/formulacell.cxx index a2891aefdf88..c97e330f2fdd 100644 --- a/sc/source/core/data/formulacell.cxx +++ b/sc/source/core/data/formulacell.cxx @@ -468,6 +468,7 @@ void adjustRangeName(formula::FormulaToken* pToken, ScDocument& rNewDoc, const S { bNewGlobal = bOldGlobal; pRangeData = new ScRangeData(*pOldRangeData, &rNewDoc); + pRangeData->SetIndex(0); // needed for insert to assign a new index ScTokenArray* pRangeNameToken = pRangeData->GetCode(); if (rNewDoc.GetPool() != const_cast<ScDocument*>(pOldDoc)->GetPool()) { |