diff options
author | Eike Rathke <erack@redhat.com> | 2016-03-16 23:03:58 +0100 |
---|---|---|
committer | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2016-03-18 14:14:43 +0000 |
commit | 00b05b936b85e0db52f0cd616bda02224c64768b (patch) | |
tree | 917ae07efa9bcd3836ed52498a06be1d4716015b | |
parent | b1667570b70cf5f2b4a12fe35e445c5d3de82452 (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
(cherry picked from commit 336d816176650726f6d14539464d9fd28ddd032d)
Reviewed-on: https://gerrit.libreoffice.org/23323
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Markus Mohrhard <markus.mohrhard@googlemail.com>
-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 5fb2c7ab0e71..8ab094c9c747 100644 --- a/sc/source/core/data/formulacell.cxx +++ b/sc/source/core/data/formulacell.cxx @@ -466,6 +466,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()) { |