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

New commits:
commit 00b05b936b85e0db52f0cd616bda02224c64768b
Author: Eike Rathke <er...@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/23323
    Tested-by: Jenkins <c...@libreoffice.org>
    Reviewed-by: Markus Mohrhard <markus.mohrh...@googlemail.com>

diff --git a/sc/source/core/data/formulacell.cxx 
b/sc/source/core/data/formulacell.cxx
index 5fb2c7a..8ab094c 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())
         {
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to