diff options
author | Steven Moreland <smoreland@google.com> | 2020-04-21 14:10:53 -0700 |
---|---|---|
committer | Steven Moreland <smoreland@google.com> | 2020-04-21 14:15:11 -0700 |
commit | c63f0320c67917c5b043e1937517c946f644d6d4 (patch) | |
tree | b903a0642251c782186182f2454853171917255a | |
parent | 650f70fd1bd553bb531a0ffc0c68c251e5528206 (diff) | |
download | platform_system_libhidl-c63f0320c67917c5b043e1937517c946f644d6d4.tar.gz platform_system_libhidl-c63f0320c67917c5b043e1937517c946f644d6d4.tar.bz2 platform_system_libhidl-c63f0320c67917c5b043e1937517c946f644d6d4.zip |
Avoid deallocating hwsm statics during shutdown.
We've had some reports of these being accessing during shutdown,
causing a crash. This is a common issue, since binder threads may still
be running while the main thread is shutdown. This is similar to
'DoNotDestruct' used elsewhere in libhidl*. Although, this class isn't
used again here since there are no ABI requirements to maintain.
Bug: 153909639
Test: boot on cuttlefish
Change-Id: Ic01dc15f739a0957f39aaf6a7b3e17fc4f7f6048
Merged-In: Ic01dc15f739a0957f39aaf6a7b3e17fc4f7f6048
-rw-r--r-- | transport/ServiceManagement.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/transport/ServiceManagement.cpp b/transport/ServiceManagement.cpp index 36010167..d7faa6db 100644 --- a/transport/ServiceManagement.cpp +++ b/transport/ServiceManagement.cpp @@ -209,8 +209,8 @@ sp<IServiceManager1_2> defaultServiceManager1_2() { using android::hidl::manager::V1_2::BnHwServiceManager; using android::hidl::manager::V1_2::BpHwServiceManager; - static std::mutex gDefaultServiceManagerLock; - static sp<IServiceManager1_2> gDefaultServiceManager; + static std::mutex& gDefaultServiceManagerLock = *new std::mutex; + static sp<IServiceManager1_2>& gDefaultServiceManager = *new sp<IServiceManager1_2>; { std::lock_guard<std::mutex> _l(gDefaultServiceManagerLock); |