summaryrefslogtreecommitdiff
path: root/drawinglayer/source/primitive2d/BufferedDecompositionPrimitive2D.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'drawinglayer/source/primitive2d/BufferedDecompositionPrimitive2D.cxx')
-rw-r--r--drawinglayer/source/primitive2d/BufferedDecompositionPrimitive2D.cxx54
1 files changed, 36 insertions, 18 deletions
diff --git a/drawinglayer/source/primitive2d/BufferedDecompositionPrimitive2D.cxx b/drawinglayer/source/primitive2d/BufferedDecompositionPrimitive2D.cxx
index c7f3b78477b0..22b6450e7f2d 100644
--- a/drawinglayer/source/primitive2d/BufferedDecompositionPrimitive2D.cxx
+++ b/drawinglayer/source/primitive2d/BufferedDecompositionPrimitive2D.cxx
@@ -69,38 +69,45 @@ const Primitive2DContainer& BufferedDecompositionPrimitive2D::getBuffered2DDecom
void BufferedDecompositionPrimitive2D::setBuffered2DDecomposition(Primitive2DContainer&& rNew)
{
- if (0 != maCallbackSeconds)
+ if (0 == maCallbackSeconds)
{
- if (maCallbackTimer.is())
+ // no flush used, just set
+ maBuffered2DDecomposition = std::move(rNew);
+ return;
+ }
+
+ if (maCallbackTimer.is())
+ {
+ if (rNew.empty())
{
- if (rNew.empty())
- {
- // stop timer
- maCallbackTimer->stop();
- }
- else
- {
- // decomposition changed, touch
- maCallbackTimer->setRemainingTime(salhelper::TTimeValue(maCallbackSeconds, 0));
- if (!maCallbackTimer->isTicking())
- maCallbackTimer->start();
- }
+ // stop timer
+ maCallbackTimer->stop();
}
- else if (!rNew.empty())
+ else
{
- // decomposition defined/set/changed, init & start timer
- maCallbackTimer.set(new LocalCallbackTimer(*this));
+ // decomposition changed, touch
maCallbackTimer->setRemainingTime(salhelper::TTimeValue(maCallbackSeconds, 0));
- maCallbackTimer->start();
+ if (!maCallbackTimer->isTicking())
+ maCallbackTimer->start();
}
}
+ else if (!rNew.empty())
+ {
+ // decomposition defined/set/changed, init & start timer
+ maCallbackTimer.set(new LocalCallbackTimer(*this));
+ maCallbackTimer->setRemainingTime(salhelper::TTimeValue(maCallbackSeconds, 0));
+ maCallbackTimer->start();
+ }
+ // tdf#158913 need to secure change when flush/multithreading is in use
+ std::lock_guard Guard(maCallbackLock);
maBuffered2DDecomposition = std::move(rNew);
}
BufferedDecompositionPrimitive2D::BufferedDecompositionPrimitive2D()
: maBuffered2DDecomposition()
, maCallbackTimer()
+ , maCallbackLock()
, maCallbackSeconds(0)
, mnTransparenceForShadow(0)
{
@@ -128,6 +135,17 @@ void BufferedDecompositionPrimitive2D::get2DDecomposition(
std::move(aNewSequence));
}
+ if (0 == maCallbackSeconds)
+ {
+ // no flush/multithreading is in use, just call
+ rVisitor.visit(getBuffered2DDecomposition());
+ return;
+ }
+
+ // tdf#158913 need to secure 'visit' when flush/multithreading is in use,
+ // so that the local non-ref-Counted instance of the decomposition gets not
+ // manipulated (e.g. deleted)
+ std::lock_guard Guard(maCallbackLock);
rVisitor.visit(getBuffered2DDecomposition());
}