mirror of
https://gitee.com/openharmony/graphic_graphic_2d
synced 2024-12-22 06:38:44 +00:00
!366 Bugfix for rs_client crash when exiting.
Merge pull request !366 from xxfeng_hw/master
This commit is contained in:
commit
f7d0739ccf
@ -20,7 +20,6 @@
|
||||
|
||||
namespace OHOS {
|
||||
namespace Rosen {
|
||||
|
||||
RSNodeMap::RSNodeMap()
|
||||
{
|
||||
// add animation fallback node
|
||||
@ -29,10 +28,17 @@ RSNodeMap::RSNodeMap()
|
||||
nodeMap_.emplace(0, fallback_node);
|
||||
}
|
||||
|
||||
RSNodeMap::~RSNodeMap() noexcept
|
||||
{
|
||||
for (auto &[id, node] : nodeMap_) {
|
||||
node = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
RSNodeMap& RSNodeMap::MutableInstance()
|
||||
{
|
||||
static RSNodeMap renderThread;
|
||||
return renderThread;
|
||||
static RSNodeMap nodeMap;
|
||||
return nodeMap;
|
||||
}
|
||||
|
||||
const RSNodeMap& RSNodeMap::Instance()
|
||||
|
@ -46,7 +46,7 @@ public:
|
||||
|
||||
private:
|
||||
explicit RSNodeMap();
|
||||
~RSNodeMap() = default;
|
||||
~RSNodeMap() noexcept;
|
||||
RSNodeMap(const RSNodeMap&) = delete;
|
||||
RSNodeMap(const RSNodeMap&&) = delete;
|
||||
RSNodeMap& operator=(const RSNodeMap&) = delete;
|
||||
|
@ -58,9 +58,7 @@ RSRenderThread::RSRenderThread()
|
||||
ROSEN_TRACE_BEGIN(BYTRACE_TAG_GRAPHIC_AGP, "RSRenderThread::DrawFrame");
|
||||
{
|
||||
prevTimestamp_ = timestamp_;
|
||||
if (!cmds_.empty()) {
|
||||
ProcessCommands();
|
||||
}
|
||||
ProcessCommands();
|
||||
}
|
||||
|
||||
ROSEN_LOGD("RSRenderThread DrawFrame(%llu) in %s", prevTimestamp_, renderContext_ ? "GPU" : "CPU");
|
||||
@ -85,6 +83,8 @@ RSRenderThread::RSRenderThread()
|
||||
|
||||
RSRenderThread::~RSRenderThread()
|
||||
{
|
||||
Stop();
|
||||
|
||||
if (renderContext_ != nullptr) {
|
||||
ROSEN_LOGD("Destory renderContext!!");
|
||||
delete renderContext_;
|
||||
@ -222,13 +222,17 @@ void RSRenderThread::StopTimer()
|
||||
|
||||
void RSRenderThread::ProcessCommands()
|
||||
{
|
||||
ROSEN_LOGD("RSRenderThread ProcessCommands size: %lu\n", cmds_.size());
|
||||
ROSEN_TRACE_BEGIN(BYTRACE_TAG_GRAPHIC_AGP, "ProcessCommands");
|
||||
std::vector<std::unique_ptr<RSTransactionData>> cmds;
|
||||
{
|
||||
std::unique_lock<std::mutex> cmdLock(cmdMutex_);
|
||||
std::swap(cmds, cmds_);
|
||||
std::unique_lock<std::mutex> cmdLock(cmdMutex_);
|
||||
if (cmds_.empty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
ROSEN_LOGD("RSRenderThread ProcessCommands size: %lu\n", cmds_.size());
|
||||
std::vector<std::unique_ptr<RSTransactionData>> cmds;
|
||||
std::swap(cmds, cmds_);
|
||||
cmdLock.unlock();
|
||||
|
||||
ROSEN_TRACE_BEGIN(BYTRACE_TAG_GRAPHIC_AGP, "ProcessCommands");
|
||||
for (auto& cmdData : cmds) {
|
||||
cmdData->Process(context_);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user