Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f764aaf9 authored by Yifan Hong's avatar Yifan Hong
Browse files

storaged: Fix double ownership for HealthInfoCallback.

SharedRefBase objects can only be created via
SharedRefBase::make, not std::make_shared. Otherwise
there'll be a double-ownership problem.

Test: TH
Fixes: 225448524
Change-Id: I856677626cb146eb52a5b4a4562148e899d5a57b
parent 8461ca59
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -153,7 +153,7 @@ void storaged_t::init_health_service() {

    mUidm.init(is_charger_on(status));
    // register listener after init uid_monitor
    aidl_health_callback = std::make_shared<HealthInfoCallback>(&mUidm);
    aidl_health_callback = ndk::SharedRefBase::make<HealthInfoCallback>(&mUidm);
    ret = health->registerCallback(aidl_health_callback);
    if (!ret.isOk()) {
        LOG(WARNING) << "health: failed to register callback: " << ret.getDescription();