diff --git a/services/native/src/power_state_machine.cpp b/services/native/src/power_state_machine.cpp index a2a4b7994a9098d1a1a3ca924c9a35bd759565a4..6d4449bf6555056f898f7abeb3571950b8d8a213 100644 --- a/services/native/src/power_state_machine.cpp +++ b/services/native/src/power_state_machine.cpp @@ -565,15 +565,15 @@ void PowerStateMachine::PowerStateCallbackDeathRecipient::OnRemoteDied(const wpt if (remote == nullptr || remote.promote() == nullptr) { return; } - auto pms = DelayedSpSingleton::GetInstance(); - if (pms == nullptr) { - POWER_HILOGE(FEATURE_POWER_STATE, "Pms is nullptr"); - return; - } sptr callback = iface_cast(remote.promote()); - FFRTTask unRegFunc = [&] { - pms->UnRegisterPowerStateCallback(callback); - }; + FFRTTask unRegFunc = std::bind([](const sptr& cb) { + auto pms = DelayedSpSingleton::GetInstance(); + if (pms == nullptr) { + POWER_HILOGE(FEATURE_POWER_STATE, "Pms is nullptr"); + return; + } + pms->UnRegisterPowerStateCallback(cb); + }, callback); FFRTUtils::SubmitTask(unRegFunc); }