diff --git a/frameworks/common/inc/user_auth_api_event_reporter.h b/frameworks/common/inc/user_auth_api_event_reporter.h index 6ccbf00e233824c9f1ef0f090009a080b012416b..82b78f6f6384dfd9deb9b66094bd7ff6d617d90b 100644 --- a/frameworks/common/inc/user_auth_api_event_reporter.h +++ b/frameworks/common/inc/user_auth_api_event_reporter.h @@ -46,7 +46,7 @@ private: bool isReported_ = false; std::string transId_; std::string apiName_; - int64_t beginTime_; + int64_t beginTime_{0}; }; } // namespace UserAuth } // namespace UserIam diff --git a/services/base/src/finite_state_machine_builder.h b/services/base/src/finite_state_machine_builder.h index 41a891636761f361d18886d0c8d632a240765bd8..87aa77fab10dd712c5c81a05127a0de72762525e 100644 --- a/services/base/src/finite_state_machine_builder.h +++ b/services/base/src/finite_state_machine_builder.h @@ -43,8 +43,8 @@ public: private: std::string name_; - uint32_t initstate_; - bool valid_; + uint32_t initstate_{0}; + bool valid_{false}; FiniteStateMachineImpl::TransitionMap transitionMap_; FiniteStateMachineImpl::EnterMap enterMap_; FiniteStateMachineImpl::LeaveMap leaveMap_; diff --git a/services/context/src/widget_context.cpp b/services/context/src/widget_context.cpp index d54a3bf45f528f245b26e2f2a3ff15416228accf..5f62a0b3707c22d84f898f48e4e75873b172f868 100644 --- a/services/context/src/widget_context.cpp +++ b/services/context/src/widget_context.cpp @@ -102,6 +102,7 @@ bool WidgetContext::Start() bool WidgetContext::Stop() { IAM_LOGI("%{public}s start", description_.c_str()); + std::lock_guard lock(mutex_); return OnStop(); } diff --git a/services/core/src/delete_impl.cpp b/services/core/src/delete_impl.cpp index b421ab0642159c290b79f56a8fafc5229e21baf3..4b109632f20b5c44672a37f23a3ccb550eff3059 100644 --- a/services/core/src/delete_impl.cpp +++ b/services/core/src/delete_impl.cpp @@ -127,10 +127,6 @@ bool DeleteImpl::Update(const std::vector &scheduleResult, std::shared_ bool DeleteImpl::Cancel() { - if (!running_) { - return false; - } - running_ = false; return true; } @@ -155,7 +151,6 @@ bool DeleteImpl::StartSchedule(int32_t userId, HdiScheduleInfo &info, } scheduleId_ = scheduleList[0]->GetScheduleId(); - running_ = true; return true; } diff --git a/services/core/src/delete_impl.h b/services/core/src/delete_impl.h index b46b16291fde9ce9f5d8de794571efb07559931a..f5b8f017cf0e72437d3c99f3cca6cbb0006136cb 100644 --- a/services/core/src/delete_impl.h +++ b/services/core/src/delete_impl.h @@ -55,7 +55,6 @@ private: uint32_t tokenId_ {0}; uint64_t scheduleId_ {0}; - bool running_ {false}; int32_t latestError_ = ResultCode::GENERAL_ERROR; }; } // namespace UserAuth diff --git a/services/core/src/enrolled_info_impl.h b/services/core/src/enrolled_info_impl.h index 54f1546c0ea921e997c9a32ebdc388041baad42d..afedfa35178f2c9493877d7ac5b69d89087c0966 100644 --- a/services/core/src/enrolled_info_impl.h +++ b/services/core/src/enrolled_info_impl.h @@ -33,7 +33,7 @@ public: uint64_t GetEnrolledId() const override; private: - int32_t userId_; + int32_t userId_{-1}; HdiEnrolledInfo info_; }; } // namespace UserAuth diff --git a/services/core/src/identification_impl.h b/services/core/src/identification_impl.h index d9c52395789ccb3ae85bfcfd3ee7d4c85c174178..4ea53140642565735227f6f11b6e51d6e5eb3984 100644 --- a/services/core/src/identification_impl.h +++ b/services/core/src/identification_impl.h @@ -45,7 +45,7 @@ protected: void SetLatestError(int32_t error) override; private: - uint64_t contextId_; + uint64_t contextId_{0}; AuthType authType_; uint32_t executorIndex_ {0}; diff --git a/services/core/src/publish_event_adapter.cpp b/services/core/src/publish_event_adapter.cpp index 87f4b1c089cbfcb5817980cd11daed7b434db755..120f73498d53962a832e947bda396e21155d50a2 100644 --- a/services/core/src/publish_event_adapter.cpp +++ b/services/core/src/publish_event_adapter.cpp @@ -113,6 +113,7 @@ void PublishEventAdapter::CachePinUpdateParam(int32_t userId, uint64_t scheduleI void PublishEventAdapter::CachePinUpdateParam(bool reEnrollFlag) { + std::lock_guard lock(mutex_); reEnrollFlag_ = reEnrollFlag; } diff --git a/services/core/src/widget_schedule_node_impl.cpp b/services/core/src/widget_schedule_node_impl.cpp index d869c7e19e2b953d14c0cdb1e7a1d91d327aaf68..b99c84074dc0e85b116312e55b2efc8a49c96071 100644 --- a/services/core/src/widget_schedule_node_impl.cpp +++ b/services/core/src/widget_schedule_node_impl.cpp @@ -190,6 +190,7 @@ bool WidgetScheduleNodeImpl::WidgetReload(uint32_t orientation, uint32_t needRot void WidgetScheduleNodeImpl::SetCallback(std::shared_ptr callback) { + std::lock_guard lock(mutex_); callback_ = callback; }