[Libreoffice-commits] core.git: Branch 'libreoffice-6-4' - sc/inc sc/source

Luboš Luňák (via logerrit) logerrit at kemper.freedesktop.org
Tue Jul 7 09:12:05 UTC 2020


 sc/inc/mtvelements.hxx              |    1 +
 sc/source/core/data/mtvelements.cxx |    5 +++++
 sc/source/core/data/table2.cxx      |    2 +-
 sc/source/core/data/table3.cxx      |    2 ++
 4 files changed, 9 insertions(+), 1 deletion(-)

New commits:
commit 6c3a6b9685acad171fda7bc5d44b0dd53b9f7268
Author:     Luboš Luňák <l.lunak at collabora.com>
AuthorDate: Wed Jul 1 11:24:08 2020 +0200
Commit:     Xisco Fauli <xiscofauli at libreoffice.org>
CommitDate: Tue Jul 7 11:11:32 2020 +0200

    don't add a cell to a non-existent column (tdf#104865)
    
    This change also needs invalidating column position hints if
    the columns get changed by the copying of the cells.
    
    Change-Id: I4793e25f253c0197d88b313bc9336435cef649f4
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/97603
    Tested-by: Jenkins
    Reviewed-by: Luboš Luňák <l.lunak at collabora.com>
    (cherry picked from commit ee2d2184133b3bf47d38a03b14abab2caa15dad1)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/97673
    Reviewed-by: Xisco Fauli <xiscofauli at libreoffice.org>
    (cherry picked from commit 8765592db900fae22ff2a0440fe94842dcbd805f)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/97684

diff --git a/sc/inc/mtvelements.hxx b/sc/inc/mtvelements.hxx
index 0727bda0fa7f..7fa266ecf8f0 100644
--- a/sc/inc/mtvelements.hxx
+++ b/sc/inc/mtvelements.hxx
@@ -167,6 +167,7 @@ public:
     ~TableColumnBlockPositionSet();
 
     ColumnBlockPosition* getBlockPosition( SCCOL nCol );
+    void invalidate(); // discards cached positions
 };
 
 ScRefCellValue toRefCell( const sc::CellStoreType::const_iterator& itPos, size_t nOffset );
diff --git a/sc/source/core/data/mtvelements.cxx b/sc/source/core/data/mtvelements.cxx
index 21eef33cad45..56c0fbab0d9a 100644
--- a/sc/source/core/data/mtvelements.cxx
+++ b/sc/source/core/data/mtvelements.cxx
@@ -150,6 +150,11 @@ ColumnBlockPosition* TableColumnBlockPositionSet::getBlockPosition( SCCOL nCol )
     return &it->second;
 }
 
+void TableColumnBlockPositionSet::invalidate()
+{
+    mpImpl->maColumns.clear();
+}
+
 ScRefCellValue toRefCell( const sc::CellStoreType::const_iterator& itPos, size_t nOffset )
 {
     switch (itPos->type)
diff --git a/sc/source/core/data/table2.cxx b/sc/source/core/data/table2.cxx
index 7597ebaddba5..638c02953219 100644
--- a/sc/source/core/data/table2.cxx
+++ b/sc/source/core/data/table2.cxx
@@ -3811,7 +3811,7 @@ void ScTable::CopyData( SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW n
 
             if (bThisTab)
             {
-                aCell.release(aCol[nDestX], nDestY);
+                aCell.release(CreateColumnIfNotExists(nDestX), nDestY);
                 SetPattern( nDestX, nDestY, *GetPattern( nCol, nRow ) );
             }
             else
diff --git a/sc/source/core/data/table3.cxx b/sc/source/core/data/table3.cxx
index 41a130d65f6c..1ee6456d84a6 100644
--- a/sc/source/core/data/table3.cxx
+++ b/sc/source/core/data/table3.cxx
@@ -3131,6 +3131,8 @@ SCSIZE ScTable::Query(const ScQueryParam& rParamOrg, bool bKeepSub)
             if (bResult)
             {
                 CopyData( aParam.nCol1,j, aParam.nCol2,j, aParam.nDestCol,nOutRow,aParam.nDestTab );
+                if( nTab == aParam.nDestTab ) // copy to self, changes may invalidate caching position hints
+                    blockPos.invalidate();
                 ++nOutRow;
             }
         }


More information about the Libreoffice-commits mailing list