[Libreoffice-commits] core.git: sc/source

Eike Rathke erack at redhat.com
Thu Mar 17 10:38:56 UTC 2016


 sc/source/core/data/formulacell.cxx |    1 +
 1 file changed, 1 insertion(+)

New commits:
commit 336d816176650726f6d14539464d9fd28ddd032d
Author: Eike Rathke <erack at redhat.com>
Date:   Wed Mar 16 23:03:58 2016 +0100

    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

diff --git a/sc/source/core/data/formulacell.cxx b/sc/source/core/data/formulacell.cxx
index a2891ae..c97e330 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())
         {


More information about the Libreoffice-commits mailing list