mirror of
https://gitee.com/openharmony/communication_ipc
synced 2024-11-23 07:50:24 +00:00
添加 NapiScopeHandler 自动管理napi_handle_scope
Signed-off-by: dengliang <15934868816@139.com>
This commit is contained in:
parent
6bce400725
commit
57fcf5ce77
@ -589,7 +589,7 @@ NapiScopeHandler::NapiScopeHandler(napi_env env) : env_(env)
|
|||||||
{
|
{
|
||||||
napi_status status = napi_open_handle_scope(env_, &scope_);
|
napi_status status = napi_open_handle_scope(env_, &scope_);
|
||||||
if (status != napi_ok) {
|
if (status != napi_ok) {
|
||||||
ZLOGE(LOG_LABEL, "napi_open_handle_scope failed, status:%{public}d", status);
|
ZLOGE(LOG_LABEL, "open handle scope failed, status:%{public}d", status);
|
||||||
isValid_ = false;
|
isValid_ = false;
|
||||||
} else {
|
} else {
|
||||||
isValid_ = true;
|
isValid_ = true;
|
||||||
@ -601,7 +601,7 @@ NapiScopeHandler::~NapiScopeHandler()
|
|||||||
if (isValid_) {
|
if (isValid_) {
|
||||||
napi_status status = napi_close_handle_scope(env_, scope_);
|
napi_status status = napi_close_handle_scope(env_, scope_);
|
||||||
if (status != napi_ok) {
|
if (status != napi_ok) {
|
||||||
ZLOGE(LOG_LABEL, "napi_close_handle_scope failed, status:%{public}d", status);
|
ZLOGE(LOG_LABEL, "close handle scope failed, status:%{public}d", status);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user