From: subhransu mohanty Date: Mon, 28 Oct 2019 07:17:22 +0000 (+0900) Subject: vector/rasterizer: safe rletask reset. X-Git-Tag: accepted/tizen/unified/20191114.123438~27 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F73%2F216573%2F1;p=platform%2Fcore%2Fuifw%2Flottie-player.git vector/rasterizer: safe rletask reset. check if the previous task is finished before reseting the task . if the previous task is not finished may lead to inconsistant task state. Change-Id: I934636745fcc87474d511eaa1c7f9a44027f8d60 --- diff --git a/src/vector/vraster.cpp b/src/vector/vraster.cpp index 80e7537..fb340db 100644 --- a/src/vector/vraster.cpp +++ b/src/vector/vraster.cpp @@ -275,18 +275,27 @@ public: } _cv.notify_one(); } - VRle &get() + void wait() { - if (!_pending) return _rle; + if (!_pending) return; + + { + std::unique_lock lock(_mutex); + while (!_ready) _cv.wait(lock); + } - std::unique_lock lock(_mutex); - while (!_ready) _cv.wait(lock); _pending = false; + } + + VRle &get() + { + wait(); return _rle; } void reset() { + wait(); _ready = false; _pending = true; }