libbinder: do not destruct SM global

Let linux clean it up, since this may be accessed by some threads after
the main thread is destructed.

Bug: 154507808 # longterm
Bug: 156785633

Test: w/ repro which calls defaultServiceManager off main thread
Change-Id: Ic109f4bdca3893e6b0b192ac27f3ff03ada6f9e2
This commit is contained in:
Steven Moreland 2020-05-15 23:43:52 +00:00
parent dd44f7465d
commit 1698ffd088

View file

@ -85,8 +85,8 @@ private:
sp<AidlServiceManager> mTheRealServiceManager;
};
static std::once_flag gSmOnce;
static sp<IServiceManager> gDefaultServiceManager;
[[clang::no_destroy]] static std::once_flag gSmOnce;
[[clang::no_destroy]] static sp<IServiceManager> gDefaultServiceManager;
sp<IServiceManager> defaultServiceManager()
{