sc/source/core/data/column4.cxx |   12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

New commits:
commit 2997c5c2604cd5054710ad35e1e0a9fd18f8ae79
Author:     Eike Rathke <er...@redhat.com>
AuthorDate: Wed Nov 24 21:23:51 2021 +0100
Commit:     Mike Kaganski <mike.kagan...@collabora.com>
CommitDate: Thu Nov 25 13:34:45 2021 +0100

    Resolves: tdf#128914 Create copies for non-shareable token arrays
    
    Change-Id: I59fdcf48fb0da9d944b00a140e043e4ea5fb1ae5
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125789
    Reviewed-by: Eike Rathke <er...@redhat.com>
    Tested-by: Jenkins
    (cherry picked from commit 89c4bc5220810dc3684a473f87d001f2c55438a1)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125725
    Reviewed-by: Mike Kaganski <mike.kagan...@collabora.com>

diff --git a/sc/source/core/data/column4.cxx b/sc/source/core/data/column4.cxx
index 54213f2cd582..14781f74d22e 100644
--- a/sc/source/core/data/column4.cxx
+++ b/sc/source/core/data/column4.cxx
@@ -566,11 +566,15 @@ void ScColumn::CloneFormulaCell(
 
         ScAddress aPos(nCol, nRow1, nTab);
 
-        if (nLen == 1)
+        if (nLen == 1 || !rSrc.GetCode()->IsShareable())
         {
-            // Single, ungrouped formula cell.
-            ScFormulaCell* pCell = new ScFormulaCell(rSrc, rDocument, aPos);
-            aFormulas.push_back(pCell);
+            // Single, ungrouped formula cell, or create copies for
+            // non-shareable token arrays.
+            for (size_t i = 0; i < nLen; ++i, aPos.IncRow())
+            {
+                ScFormulaCell* pCell = new ScFormulaCell(rSrc, rDocument, 
aPos);
+                aFormulas.push_back(pCell);
+            }
         }
         else
         {

Reply via email to