!550 merge master into master

fix HandleCallbackInfoUpdate memery leak

Created-by: hcwww
Commit-by: hcwww
Merged-by: openharmony_ci
Description: ### 一、内容说明(相关的Issue)
https://gitcode.com/openharmony/telephony_state_registry/issues/256


### 二、建议测试周期和提测地址  
  建议测试完成时间:xxxx.xx.xx  
  投产上线时间:xxxx.xx.xx  
  提测地址:CI环境/压测环境  
  测试账号:  

### 三、变更内容
  * 3.1 关联PR列表

  * 3.2 数据库和部署说明  
    1. 常规更新 
    2. 重启unicorn
    3. 重启sidekiq
    4. 迁移任务:是否有迁移任务,没有写 "无"
    5. rake脚本:`bundle exec xxx RAILS_ENV = production`;没有写 "无"

  * 3.4 其他技术优化内容(做了什么,变更了什么)
    - 修复ffi层HandleCallbackInfoUpdate内存泄漏


  * 3.5 废弃通知(什么字段、方法弃用?)



  * 3.6  后向不兼容变更(是否有无法向后兼容的变更?)


  
### 四、研发自测点(自测哪些?冒烟用例全部自测?)
  自测测试结论:


### 五、测试关注点(需要提醒QA重点关注的、可能会忽略的地方)
  检查点:

| 需求名称 | 是否影响xx公共模块 | 是否需要xx功能 | 需求升级是否依赖其他子产品 |
|------|------------|----------|---------------|
| xxx  | 否          | 需要       | 不需要           |
|      |            |          |               |

  接口测试:

  性能测试:

  并发测试:

  其他:



See merge request: openharmony/telephony_state_registry!550
This commit is contained in:
openharmony_ci
2026-06-03 17:37:25 +08:00
+31 -7
View File
@@ -338,6 +338,7 @@ void ObserverEventHandler::HandleCallbackInfoUpdate(const AppExecFwk::InnerEvent
}
work->data = static_cast<void *>(data);
WorkUpdated(listen, work, lock);
delete data;
delete work;
work = nullptr;
}
@@ -427,7 +428,11 @@ void ObserverEventHandler::WorkCallStateUpdated(const EventListener &listener,
TELEPHONY_LOGE("work is null");
return;
}
std::unique_ptr<CallStateUpdateInfo> callStateInfo(static_cast<CallStateUpdateInfo *>(work->data));
if (work->data == nullptr) {
TELEPHONY_LOGE("work data is null");
return;
}
CallStateUpdateInfo *callStateInfo = static_cast<CallStateUpdateInfo *>(work->data);
std::string phoneNumber = ToUtf8(callStateInfo->phoneNumber_);
CCallStateInfo callbackValue = {
.state = WrapCallState(callStateInfo->callState_),
@@ -444,7 +449,11 @@ void ObserverEventHandler::WorkSignalUpdated(const EventListener &listener,
TELEPHONY_LOGE("work is null");
return;
}
std::unique_ptr<SignalUpdateInfo> infoListUpdateInfo(static_cast<SignalUpdateInfo *>(work->data));
if (work->data == nullptr) {
TELEPHONY_LOGE("work data is null");
return;
}
SignalUpdateInfo *infoListUpdateInfo = static_cast<SignalUpdateInfo *>(work->data);
size_t infoSize = infoListUpdateInfo->signalInfoList_.size();
if (infoSize <= 0) {
TELEPHONY_LOGE("signalInfoList_ size error");
@@ -477,7 +486,11 @@ void ObserverEventHandler::WorkNetworkStateUpdated(const EventListener &listener
TELEPHONY_LOGE("work is null");
return;
}
std::unique_ptr<NetworkStateUpdateInfo> networkStateUpdateInfo(static_cast<NetworkStateUpdateInfo *>(work->data));
if (work->data == nullptr) {
TELEPHONY_LOGE("work data is null");
return;
}
NetworkStateUpdateInfo *networkStateUpdateInfo = static_cast<NetworkStateUpdateInfo *>(work->data);
const sptr<NetworkState> &networkState = networkStateUpdateInfo->networkState_;
std::string longOperatorName = networkState->GetLongOperatorName();
std::string shortOperatorName = networkState->GetShortOperatorName();
@@ -509,7 +522,11 @@ void ObserverEventHandler::WorkSimStateUpdated(const EventListener &listener,
TELEPHONY_LOGE("work is null");
return;
}
std::unique_ptr<SimStateUpdateInfo> simStateUpdateInfo(static_cast<SimStateUpdateInfo *>(work->data));
if (work->data == nullptr) {
TELEPHONY_LOGE("work data is null");
return;
}
SimStateUpdateInfo *simStateUpdateInfo = static_cast<SimStateUpdateInfo *>(work->data);
int32_t cardType = static_cast<int32_t>(simStateUpdateInfo->type_);
int32_t simState = static_cast<int32_t>(simStateUpdateInfo->state_);
int32_t lockReason = static_cast<int32_t>(simStateUpdateInfo->reason_);
@@ -538,8 +555,11 @@ void ObserverEventHandler::WorkCellularDataConnectStateUpdated(const EventListen
TELEPHONY_LOGE("work is null");
return;
}
std::unique_ptr<CellularDataConnectState> context(
static_cast<CellularDataConnectState *>(work->data));
if (work->data == nullptr) {
TELEPHONY_LOGE("work data is null");
return;
}
CellularDataConnectState *context = static_cast<CellularDataConnectState *>(work->data);
CDataConnectionStateInfo callbackValue = {
.state = context->dataState_,
.network = context->networkType_
@@ -555,7 +575,11 @@ void ObserverEventHandler::WorkCellularDataFlowUpdated(const EventListener &list
TELEPHONY_LOGE("work is null");
return;
}
std::unique_ptr<CellularDataFlowUpdate> dataFlowInfo(static_cast<CellularDataFlowUpdate *>(work->data));
if (work->data == nullptr) {
TELEPHONY_LOGE("work data is null");
return;
}
CellularDataFlowUpdate *dataFlowInfo = static_cast<CellularDataFlowUpdate *>(work->data);
void* argv = &(dataFlowInfo->flowType_);
listener.callbackRef(argv);
}