Do not destruct static maps.
In case they are deleted while some threads are using them (this
happens sometimes depending on how these libraries are loaded and how
they are being used).
Noting that b/69122224 is filed to move these into functions.
Bug: 129726097
Test: HIDL's run_all_device_tests.sh
Test: no longer see error where it repro'd before:
FORTIFY: pthread_mutex_lock called on a destroyed mutex
Change-Id: I66eb9aa24e31d7fc652f0426361c17600b4716ec
diff --git a/transport/HidlPassthroughSupport.cpp b/transport/HidlPassthroughSupport.cpp
index ff68a1e..bc67656 100644
--- a/transport/HidlPassthroughSupport.cpp
+++ b/transport/HidlPassthroughSupport.cpp
@@ -31,7 +31,7 @@
auto func = getBsConstructorMap().get(descriptor, nullptr);
if (!func) {
// TODO(b/69122224): remove this when prebuilts don't reference it
- func = gBsConstructorMap.get(descriptor, nullptr);
+ func = gBsConstructorMap->get(descriptor, nullptr);
}
if (func) {
return func(static_cast<void*>(iface.get()));