From c9d5b5bcfe144f85c1080d28b34a9751b257b501 Mon Sep 17 00:00:00 2001 From: houdisheng Date: Thu, 23 Mar 2023 21:29:41 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A7=A3=E5=86=B3uv=5Fqueue=5Fwork=E4=B8=ADnap?= =?UTF-8?q?i=5Fvalue=E5=AF=B9=E8=B1=A1=E5=86=85=E5=AD=98=E6=B3=84=E9=9C=B2?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: houdisheng --- frameworks/src/app_group_observer_napi.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/frameworks/src/app_group_observer_napi.cpp b/frameworks/src/app_group_observer_napi.cpp index f9ab0c1..142a945 100644 --- a/frameworks/src/app_group_observer_napi.cpp +++ b/frameworks/src/app_group_observer_napi.cpp @@ -90,6 +90,11 @@ void UvQueueWorkOnAppGroupChanged(uv_work_t *work, int status) work = nullptr; return; } + napi_handle_scope scope = nullptr; + napi_open_handle_scope(callbackReceiveDataWorkerData->env, &scope); + if (scope == nullptr) { + return; + } napi_value result = nullptr; napi_create_object(callbackReceiveDataWorkerData->env, &result); @@ -113,6 +118,8 @@ void UvQueueWorkOnAppGroupChanged(uv_work_t *work, int status) results[PARAM_SECOND] = result; NAPI_CALL_RETURN_VOID(callbackReceiveDataWorkerData->env, napi_call_function(callbackReceiveDataWorkerData->env, undefined, callback, ARGS_TWO, &results[PARAM_FIRST], &resultout)); + + napi_close_handle_scope(callbackReceiveDataWorkerData->env, scope); delete callbackReceiveDataWorkerData; callbackReceiveDataWorkerData = nullptr; delete work; -- Gitee