[Libreoffice-commits] core.git: Branch 'libreoffice-5-0' - sc/source

Eike Rathke erack at redhat.com
Fri Mar 18 14:15:12 UTC 2016


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

New commits:
commit d277c677ba430ee682c291da1a178f85ac98c424
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
    (cherry picked from commit 336d816176650726f6d14539464d9fd28ddd032d)
    Reviewed-on: https://gerrit.libreoffice.org/23324
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Markus Mohrhard <markus.mohrhard at googlemail.com>

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


More information about the Libreoffice-commits mailing list