fix tel ril crash

Signed-off-by: rsin <renxin20@h-partners.com>
This commit is contained in:
rsin 2024-11-15 10:01:59 +00:00 committed by Gitee
parent d15e9ba47f
commit 6060e3e47a
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F

View File

@ -22,6 +22,7 @@ namespace Telephony {
std::atomic_int TelRilBase::nextSerialId_(1);
std::unordered_map<int32_t, std::shared_ptr<TelRilRequest>> TelRilBase::requestMap_;
std::mutex TelRilBase::requestLock_;
std::mutex idleLock_;
std::shared_ptr<TelRilHandler> TelRilBase::handler_;
TelRilBase::TelRilBase(int32_t slotId, sptr<HDI::Ril::V1_3::IRil> rilInterface,
@ -33,9 +34,16 @@ TelRilBase::TelRilBase(int32_t slotId, sptr<HDI::Ril::V1_3::IRil> rilInterface,
void TelRilBase::ResetRilInterface(sptr<HDI::Ril::V1_3::IRil> rilInterface)
{
std::lock_guard<std::mutex> lock(idleLock_);
rilInterface_ = rilInterface;
}
sptr<HDI::Ril::V1_3::IRil> TelRilBase::GetRilInterface()
{
std::lock_guard<std::mutex> lock(idleLock_);
return rilInterface_;
}
sptr<HDI::Ril::V1_3::IRil> getRilInterface()
{
return;
@ -88,7 +96,7 @@ std::shared_ptr<TelRilRequest> TelRilBase::FindTelRilRequest(const RadioResponse
int32_t TelRilBase::GetSerialId(const AppExecFwk::InnerEvent::Pointer &response)
{
if (rilInterface_ == nullptr) {
if (GetRilInterface() == nullptr) {
TELEPHONY_LOGE("ERROR : rilInterface_ == nullptr !!!");
return -TELEPHONY_ERR_ARGUMENT_INVALID;
}