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

Commit 0c6f5aa6 authored by Xiang Wang's avatar Xiang Wang
Browse files

Add [[clang::no_destroy]] to static global vars that could be used in onBinderDied

Bug: 443606463
Flag: EXEMPT BUGFIX
Test: m
Change-Id: I780dc54d45ba61a5b60c5fef54fc6c4fcf997635
parent 80c135d0
Loading
Loading
Loading
Loading
+6 −5
Original line number Diff line number Diff line
@@ -62,9 +62,9 @@ static struct {
jfloat gUndefinedTemperature;

static void getThermalHalLocked();
static std::mutex gThermalHalMutex;
static sp<hardware::thermal::V1_0::IThermal> gThermalHidlHal = nullptr;
static std::shared_ptr<IThermal> gThermalAidlHal = nullptr;
[[clang::no_destroy]] static std::mutex gThermalHalMutex;
[[clang::no_destroy]] static sp<hardware::thermal::V1_0::IThermal> gThermalHidlHal = nullptr;
[[clang::no_destroy]] static std::shared_ptr<IThermal> gThermalAidlHal = nullptr;

struct ThermalHidlHalDeathRecipient : virtual public hidl_death_recipient {
    // hidl_death_recipient interface
@@ -83,8 +83,9 @@ static void onThermalAidlBinderDied(void *cookie) {
    getThermalHalLocked();
}

sp<ThermalHidlHalDeathRecipient> gThermalHidlHalDeathRecipient = nullptr;
ndk::ScopedAIBinder_DeathRecipient gThermalAidlDeathRecipient;
[[clang::no_destroy]] static sp<ThermalHidlHalDeathRecipient> gThermalHidlHalDeathRecipient =
        nullptr;
[[clang::no_destroy]] static ndk::ScopedAIBinder_DeathRecipient gThermalAidlDeathRecipient;

// ----------------------------------------------------------------------------