!16944 Canvas GetPixelMap Crash

Merge pull request !16944 from redermens/gitpixelmap
This commit is contained in:
openharmony_ci 2024-11-09 08:40:35 +00:00 committed by Gitee
commit c3708f7cca
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F

View File

@ -1594,7 +1594,7 @@ bool RSRenderServiceConnection::GetPixelmap(NodeId id, const std::shared_ptr<Med
std::future<bool> future = result.get_future(); std::future<bool> future = result.get_future();
RSMainThread* mainThread = mainThread_; RSMainThread* mainThread = mainThread_;
RSUniRenderThread* renderThread = &renderThread_; RSUniRenderThread* renderThread = &renderThread_;
auto getPixelMapTask = [id, &pixelmap, rect, drawCmdList, mainThread, renderThread, &result]() { auto getPixelMapTask = [id, pixelmap, rect, drawCmdList, mainThread, renderThread, &result]() {
auto node = mainThread->GetContext().GetNodeMap().GetRenderNode<RSCanvasDrawingRenderNode>(id); auto node = mainThread->GetContext().GetNodeMap().GetRenderNode<RSCanvasDrawingRenderNode>(id);
if (node == nullptr) { if (node == nullptr) {
RS_LOGD("RSRenderServiceConnection::GetPixelmap: cannot find NodeId: [%{public}" PRIu64 "]", id); RS_LOGD("RSRenderServiceConnection::GetPixelmap: cannot find NodeId: [%{public}" PRIu64 "]", id);
@ -1612,7 +1612,7 @@ bool RSRenderServiceConnection::GetPixelmap(NodeId id, const std::shared_ptr<Med
if (drawableNode) { if (drawableNode) {
tid = std::static_pointer_cast<DrawableV2::RSCanvasDrawingRenderNodeDrawable>(drawableNode)->GetTid(); tid = std::static_pointer_cast<DrawableV2::RSCanvasDrawingRenderNodeDrawable>(drawableNode)->GetTid();
} }
auto getDrawablePixelmapTask = [drawableNode, &pixelmap, rect, &result, tid, drawCmdList]() { auto getDrawablePixelmapTask = [drawableNode, pixelmap, rect, &result, tid, drawCmdList]() {
result.set_value(std::static_pointer_cast<DrawableV2::RSCanvasDrawingRenderNodeDrawable>(drawableNode)-> result.set_value(std::static_pointer_cast<DrawableV2::RSCanvasDrawingRenderNodeDrawable>(drawableNode)->
GetPixelmap(pixelmap, rect, tid, drawCmdList)); GetPixelmap(pixelmap, rect, tid, drawCmdList));
}; };