[Libreoffice-commits] core.git: Branch 'libreoffice-7-0' - sc/inc sc/source
LuboÅ¡ LuÅák (via logerrit)
logerrit at kemper.freedesktop.org
Wed Mar 10 09:19:52 UTC 2021
sc/inc/segmenttree.hxx | 9 +++++++++
sc/source/core/data/segmenttree.cxx | 32 ++++++++++++++++++++++++++++++++
sc/source/core/data/table1.cxx | 5 +++++
3 files changed, 46 insertions(+)
New commits:
commit 99890e4450ceae45f30da1667c85da73deabfdc9
Author: Luboš Luňák <l.lunak at collabora.com>
AuthorDate: Mon Mar 8 22:50:58 2021 +0100
Commit: Xisco Fauli <xiscofauli at libreoffice.org>
CommitDate: Wed Mar 10 10:19:15 2021 +0100
fix ScFlatBoolSegmentsImpl delayed setup with threads (tdf#140754)
Change-Id: I258263f6a15e7098a2292ba7f3336fcaaf5224ff
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112184
Tested-by: Jenkins
Reviewed-by: Luboš Luňák <l.lunak at collabora.com>
(cherry picked from commit 2fb274950e5207ca55f4f52325fb522bd44024e1)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112212
Reviewed-by: Xisco Fauli <xiscofauli at libreoffice.org>
Signed-off-by: Xisco Fauli <xiscofauli at libreoffice.org>
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112250
diff --git a/sc/inc/segmenttree.hxx b/sc/inc/segmenttree.hxx
index 9d772a0b4b46..cbdb5a7c89d1 100644
--- a/sc/inc/segmenttree.hxx
+++ b/sc/inc/segmenttree.hxx
@@ -76,6 +76,9 @@ public:
SCROW findLastTrue() const;
+ // Builds internal data (so that it doesn't build them while used in threads).
+ void makeReady();
+
private:
::std::unique_ptr<ScFlatBoolSegmentsImpl> mpImpl;
};
@@ -99,6 +102,9 @@ public:
void removeSegment(SCCOL nCol1, SCCOL nCol2);
void insertSegment(SCCOL nCol, SCCOL nSize);
+ // Builds internal data (so that it doesn't build them while used in threads).
+ void makeReady();
+
private:
::std::unique_ptr<ScFlatBoolSegmentsImpl> mpImpl;
};
@@ -147,6 +153,9 @@ public:
void enableTreeSearch(bool bEnable);
+ // Builds internal data (so that it doesn't build them while used in threads).
+ void makeReady();
+
private:
::std::unique_ptr<ScFlatUInt16SegmentsImpl> mpImpl;
};
diff --git a/sc/source/core/data/segmenttree.cxx b/sc/source/core/data/segmenttree.cxx
index 254f0f875571..5d7adc18df87 100644
--- a/sc/source/core/data/segmenttree.cxx
+++ b/sc/source/core/data/segmenttree.cxx
@@ -24,6 +24,7 @@
#include <algorithm>
#include <limits>
#include <address.hxx>
+#include <global.hxx>
using ::std::numeric_limits;
@@ -66,6 +67,8 @@ public:
mbTreeSearchEnabled = b;
}
+ void makeReady();
+
private:
typedef ::mdds::flat_segment_tree<SCCOLROW, ValueType> fst_type;
fst_type maSegments;
@@ -131,7 +134,10 @@ typename ScFlatSegmentsImpl<ValueType_, ExtValueType_>::ValueType ScFlatSegments
}
if (!maSegments.is_tree_valid())
+ {
+ assert(!ScGlobal::bThreadedGroupCalcInProgress);
maSegments.build_tree();
+ }
maSegments.search_tree(nPos, nValue);
return nValue;
@@ -185,7 +191,10 @@ bool ScFlatSegmentsImpl<ValueType_, ExtValueType_>::getRangeData(SCCOLROW nPos,
return getRangeDataLeaf(nPos, rData);
if (!maSegments.is_tree_valid())
+ {
+ assert(!ScGlobal::bThreadedGroupCalcInProgress);
maSegments.build_tree();
+ }
if (!maSegments.search_tree(nPos, rData.mnValue, &rData.mnPos1, &rData.mnPos2).second)
return false;
@@ -267,6 +276,14 @@ bool ScFlatSegmentsImpl<ValueType_, ExtValueType_>::getNext(RangeData& rData)
return true;
}
+template<typename ValueType_, typename ExtValueType_>
+void ScFlatSegmentsImpl<ValueType_, ExtValueType_>::makeReady()
+{
+ assert(!ScGlobal::bThreadedGroupCalcInProgress);
+ if (!maSegments.is_tree_valid())
+ maSegments.build_tree();
+}
+
class ScFlatUInt16SegmentsImpl : public ScFlatSegmentsImpl<sal_uInt16, sal_uInt32>
{
public:
@@ -416,6 +433,11 @@ SCROW ScFlatBoolRowSegments::findLastTrue() const
return mpImpl->findLastTrue(false);
}
+void ScFlatBoolRowSegments::makeReady()
+{
+ mpImpl->makeReady();
+}
+
ScFlatBoolColSegments::ScFlatBoolColSegments(SCCOL nMaxCol) :
mpImpl(new ScFlatBoolSegmentsImpl(nMaxCol))
{
@@ -462,6 +484,11 @@ void ScFlatBoolColSegments::insertSegment(SCCOL nCol, SCCOL nSize)
mpImpl->insertSegment(static_cast<SCCOLROW>(nCol), static_cast<SCCOLROW>(nSize), true/*bSkipStartBoundary*/);
}
+void ScFlatBoolColSegments::makeReady()
+{
+ mpImpl->makeReady();
+}
+
ScFlatUInt16RowSegments::ForwardIterator::ForwardIterator(ScFlatUInt16RowSegments& rSegs) :
mrSegs(rSegs), mnCurPos(0), mnLastPos(-1), mnCurValue(0)
{
@@ -554,4 +581,9 @@ void ScFlatUInt16RowSegments::setValueIf(SCROW nRow1, SCROW nRow2, sal_uInt16 nV
mpImpl->setValueIf(static_cast<SCCOLROW>(nRow1), static_cast<SCCOLROW>(nRow2), nValue, rPredicate);
}
+void ScFlatUInt16RowSegments::makeReady()
+{
+ mpImpl->makeReady();
+}
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/core/data/table1.cxx b/sc/source/core/data/table1.cxx
index 16e6e5d594d5..b1d25358557b 100644
--- a/sc/source/core/data/table1.cxx
+++ b/sc/source/core/data/table1.cxx
@@ -2456,6 +2456,11 @@ bool ScTable::HandleRefArrayForParallelism( SCCOL nCol, SCROW nRow1, SCROW nRow2
if ( !IsColValid( nCol ) || !ValidRow( nRow1 ) || !ValidRow( nRow2 ) )
return false;
+ mpHiddenCols->makeReady();
+ mpHiddenRows->makeReady();
+ mpFilteredCols->makeReady();
+ mpFilteredRows->makeReady();
+
return aCol[nCol].HandleRefArrayForParallelism(nRow1, nRow2, mxGroup);
}
More information about the Libreoffice-commits
mailing list