summaryrefslogtreecommitdiff
path: root/libs/hwui/renderthread/RenderThread.cpp
diff options
context:
space:
mode:
authorScott Lobdell <slobdell@google.com>2021-04-08 04:27:11 +0000
committerScott Lobdell <slobdell@google.com>2021-04-09 17:32:37 +0000
commit5f1da148b08c14445ce83ca151a84f75e489d274 (patch)
treedf59b2056d1fe2dbe09f6c85463ddf1769daf4e6 /libs/hwui/renderthread/RenderThread.cpp
parent702f04add003ce3e490a2f0bdff083a7e6f5979e (diff)
parent851218af5f83cdb89c02d680fb22212318150068 (diff)
Merge SP1A.210407.002
Change-Id: Iaad2b7cc2aeba166f003d0d460bc8ce29d1caab3
Diffstat (limited to 'libs/hwui/renderthread/RenderThread.cpp')
-rw-r--r--libs/hwui/renderthread/RenderThread.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/libs/hwui/renderthread/RenderThread.cpp b/libs/hwui/renderthread/RenderThread.cpp
index adf4aee8b931..79b938841bc2 100644
--- a/libs/hwui/renderthread/RenderThread.cpp
+++ b/libs/hwui/renderthread/RenderThread.cpp
@@ -153,10 +153,11 @@ JVMAttachHook RenderThread::getOnStartHook() {
}
RenderThread& RenderThread::getInstance() {
- // This is a pointer because otherwise __cxa_finalize
- // will try to delete it like a Good Citizen but that causes us to crash
- // because we don't want to delete the RenderThread normally.
- static RenderThread* sInstance = new RenderThread();
+ [[clang::no_destroy]] static sp<RenderThread> sInstance = []() {
+ sp<RenderThread> thread = sp<RenderThread>::make();
+ thread->start("RenderThread");
+ return thread;
+ }();
gHasRenderThreadInstance = true;
return *sInstance;
}
@@ -171,7 +172,6 @@ RenderThread::RenderThread()
, mFunctorManager(WebViewFunctorManager::instance())
, mGlobalProfileData(mJankDataMutex) {
Properties::load();
- start("RenderThread");
}
RenderThread::~RenderThread() {