mirror of
https://gitee.com/openharmony/communication_ipc
synced 2024-11-30 11:30:30 +00:00
fix mem leak
Signed-off-by: 18392170496 <magentang4@huawei.com>
This commit is contained in:
parent
42de956069
commit
ad0d05e275
@ -29,12 +29,12 @@ struct DeleteJsRefParam {
|
||||
};
|
||||
|
||||
NAPIRemoteObjectHolder::NAPIRemoteObjectHolder(napi_env env, const std::u16string &descriptor, napi_value thisVar)
|
||||
: env_(env), descriptor_(descriptor), sptrCachedObject_(nullptr), wptrCachedObject_(nullptr), localInterfaceRef_(nullptr),
|
||||
attachCount_(1), jsObjectRef_(nullptr)
|
||||
: env_(env), descriptor_(descriptor), sptrCachedObject_(nullptr), wptrCachedObject_(nullptr),
|
||||
localInterfaceRef_(nullptr), attachCount_(1), jsObjectRef_(nullptr)
|
||||
{
|
||||
jsThreadId_ = std::this_thread::get_id();
|
||||
// create weak ref, do not need to delete
|
||||
// increase ref count when the JS object will transfer to another thread or process
|
||||
// create weak ref, do not need to delete,
|
||||
// increase ref count when the JS object will transfer to another thread or process.
|
||||
napi_create_reference(env, thisVar, 0, &jsObjectRef_);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user