!716 【问题修复】将uv_queue_work中的napi_value定义移动到napi_handle_scope包裹的范围内

Merge pull request !716 from Hollokin/master
This commit is contained in:
openharmony_ci 2023-05-11 09:43:42 +00:00 committed by Gitee
commit b5f3133d70
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F

View File

@ -100,7 +100,6 @@ void PanelListenerImpl::OnPanelStatus(uint32_t windowId, bool isShow)
uv_queue_work(
loop, work, [](uv_work_t *work) {},
[](uv_work_t *work, int status) {
napi_value callback = nullptr;
std::shared_ptr<UvEntry> entry(static_cast<UvEntry *>(work->data), [work](UvEntry *data) {
delete data;
delete work;
@ -108,6 +107,7 @@ void PanelListenerImpl::OnPanelStatus(uint32_t windowId, bool isShow)
CHECK_RETURN_VOID(entry != nullptr, "OnInputStart:: entry is null.");
napi_handle_scope scope = nullptr;
napi_open_handle_scope(entry->cbCopy->env_, &scope);
napi_value callback = nullptr;
napi_get_reference_value(entry->cbCopy->env_, entry->cbCopy->callback_, &callback);
if (callback != nullptr) {
napi_value global = nullptr;