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:53 +0000 |
commit | d277c677ba430ee682c291da1a178f85ac98c424 (patch) | |
tree | 4649fb0098d82be1774fafceebdc22317a892083 /sc/source/core/data | |
parent | e7e1720e5751e5ff8b6af4e1324f01a74b28a4a8 (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/23324
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Markus Mohrhard <markus.mohrhard@googlemail.com>
Diffstat (limited to 'sc/source/core/data')
-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 b34261bf6c0a..1f9ffec6436a 100644 --- a/sc/source/core/data/formulacell.cxx +++ b/sc/source/core/data/formulacell.cxx @@ -331,6 +331,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()) { |