From c563afa225fde7bc34ee388e2f628ede5e432812 Mon Sep 17 00:00:00 2001 From: li-tiangang4 Date: Fri, 11 Jul 2025 15:19:58 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9modem=20crash=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: li-tiangang4 --- .../include/utils/dh_modem_context_ext.h | 3 +-- .../src/utils/dh_modem_context_ext.cpp | 9 ++++----- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/services/distributedhardwarefwkservice/include/utils/dh_modem_context_ext.h b/services/distributedhardwarefwkservice/include/utils/dh_modem_context_ext.h index 37ece4a1..3aada4e4 100644 --- a/services/distributedhardwarefwkservice/include/utils/dh_modem_context_ext.h +++ b/services/distributedhardwarefwkservice/include/utils/dh_modem_context_ext.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2024 Huawei Device Co., Ltd. + * Copyright (c) 2024-2025 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -33,7 +33,6 @@ public: private: void *soHandle_ {nullptr}; - std::shared_ptr distributedModemExt_; }; } // namespace DistributedHardware } // namespace OHOS diff --git a/services/distributedhardwarefwkservice/src/utils/dh_modem_context_ext.cpp b/services/distributedhardwarefwkservice/src/utils/dh_modem_context_ext.cpp index 66cba1aa..03c0bc33 100644 --- a/services/distributedhardwarefwkservice/src/utils/dh_modem_context_ext.cpp +++ b/services/distributedhardwarefwkservice/src/utils/dh_modem_context_ext.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2024 Huawei Device Co., Ltd. + * Copyright (c) 2024-2025 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -50,16 +50,15 @@ std::shared_ptr DHModemContextExt::GetModemExtInstance() { if (soHandle_ == nullptr && GetHandler() != DH_FWK_SUCCESS) { DHLOGE("load modem_ext so failed."); - return distributedModemExt_; + return nullptr; } auto func = (CreateDistributedModemExtImplFuncPtr)dlsym(soHandle_, "CreateDistributedModemExtImplObject"); if (dlerror() != nullptr || func == nullptr) { dlclose(soHandle_); DHLOGE("Create object function is not exist."); - return distributedModemExt_; + return nullptr; } - distributedModemExt_ = std::shared_ptr(func()); - return distributedModemExt_; + return std::shared_ptr(func()); } int32_t DHModemContextExt::UnInit() -- Gitee