Merge pull request !10057 from zhuhan/envdfx
This commit is contained in:
openharmony_ci 2024-08-22 14:08:12 +00:00 committed by Gitee
commit 87920fe720
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
2 changed files with 11 additions and 2 deletions

View File

@ -473,7 +473,10 @@ ohos_shared_library("appkit_delegator") {
}
config("application_context_manager_config") {
include_dirs = [ "${ability_runtime_path}/interfaces/kits/native/appkit/ability_runtime/context" ]
include_dirs = [
"${ability_runtime_path}/interfaces/kits/native/appkit/ability_runtime/context",
"${ability_runtime_services_path}/common/include",
]
}
ohos_shared_library("appkit_manager_helper") {
@ -530,6 +533,7 @@ ohos_shared_library("application_context_manager") {
external_deps = [
"ets_runtime:libark_jsruntime",
"hilog:libhilog",
"napi:ace_napi",
]

View File

@ -15,6 +15,8 @@
#include "application_context_manager.h"
#include "hilog_tag_wrapper.h"
namespace OHOS {
namespace AbilityRuntime {
namespace {
@ -52,7 +54,10 @@ void ApplicationContextManager::AddGlobalObject(napi_env env,
if (envData == nullptr) {
return;
}
napi_add_env_cleanup_hook(env, HandleClean, static_cast<void*>(envData));
auto ret = napi_add_env_cleanup_hook(env, HandleClean, static_cast<void*>(envData));
if (ret != napi_status::napi_ok) {
TAG_LOGE(AAFwkTag::APPKIT, "add hook err");
}
std::lock_guard<std::mutex> lock(applicationContextMutex_);
auto iter = applicationContextMap_.find(env);
if (iter == applicationContextMap_.end()) {