From 0746fe0962053c80edf711929d758987fa00a8f4 Mon Sep 17 00:00:00 2001 From: bailu1992 Date: Wed, 16 Oct 2024 10:46:55 +0800 Subject: [PATCH] crash problem modification Signed-off-by: bailu1992 --- frameworks/js/napi/include/async_callback_info.h | 2 ++ services/src/sensor_power_policy.cpp | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/frameworks/js/napi/include/async_callback_info.h b/frameworks/js/napi/include/async_callback_info.h index f60bbb9e..017ea65a 100644 --- a/frameworks/js/napi/include/async_callback_info.h +++ b/frameworks/js/napi/include/async_callback_info.h @@ -118,11 +118,13 @@ public: if (asyncWork != nullptr) { SEN_HILOGD("Delete async work"); napi_delete_async_work(env, asyncWork); + asyncWork = nullptr; } for (int32_t i = 0; i < CALLBACK_NUM; ++i) { if (callback[i] != nullptr) { SEN_HILOGD("Delete reference, i:%{public}d", i); napi_delete_reference(env, callback[i]); + callback[i] = nullptr; } } } diff --git a/services/src/sensor_power_policy.cpp b/services/src/sensor_power_policy.cpp index 82bbf157..2debb6c2 100644 --- a/services/src/sensor_power_policy.cpp +++ b/services/src/sensor_power_policy.cpp @@ -47,7 +47,7 @@ ErrCode SensorPowerPolicy::SuspendSensors(int32_t pid) CALL_LOG_ENTER; std::vector sensorIdList = clientInfo_.GetSensorIdByPid(pid); if (sensorIdList.empty()) { - SEN_HILOGI("Suspend sensors failed, sensorIdList is empty, pid:%{public}d", pid); + SEN_HILOGD("Suspend sensors failed, sensorIdList is empty, pid:%{public}d", pid); return SUSPEND_ERR; } std::lock_guard pidSensorInfoLock(pidSensorInfoMutex_); @@ -107,7 +107,7 @@ ErrCode SensorPowerPolicy::ResumeSensors(int32_t pid) std::lock_guard pidSensorInfoLock(pidSensorInfoMutex_); auto pidSensorInfoIt = pidSensorInfoMap_.find(pid); if (pidSensorInfoIt == pidSensorInfoMap_.end()) { - SEN_HILOGI("Resume sensors failed, please suspend sensors first, pid:%{public}d", pid); + SEN_HILOGD("Resume sensors failed, please suspend sensors first, pid:%{public}d", pid); return RESUME_ERR; } bool isAllResume = true; -- Gitee