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

New commits:
commit 89c4bc5220810dc3684a473f87d001f2c55438a1
Author:     Eike Rathke <er...@redhat.com>
AuthorDate: Wed Nov 24 21:23:51 2021 +0100
Commit:     Eike Rathke <er...@redhat.com>
CommitDate: Wed Nov 24 22:42:05 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

diff --git a/sc/source/core/data/column4.cxx b/sc/source/core/data/column4.cxx
index 39829122c17e..fc4c3a5e38e2 100644
--- a/sc/source/core/data/column4.cxx
+++ b/sc/source/core/data/column4.cxx
@@ -564,11 +564,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