Merge "libhwui: RenderThread: fix UAF" into sc-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
f3aba6eed5
@@ -153,10 +153,11 @@ JVMAttachHook RenderThread::getOnStartHook() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
RenderThread& RenderThread::getInstance() {
|
RenderThread& RenderThread::getInstance() {
|
||||||
// This is a pointer because otherwise __cxa_finalize
|
[[clang::no_destroy]] static sp<RenderThread> sInstance = []() {
|
||||||
// will try to delete it like a Good Citizen but that causes us to crash
|
sp<RenderThread> thread = sp<RenderThread>::make();
|
||||||
// because we don't want to delete the RenderThread normally.
|
thread->start("RenderThread");
|
||||||
static RenderThread* sInstance = new RenderThread();
|
return thread;
|
||||||
|
}();
|
||||||
gHasRenderThreadInstance = true;
|
gHasRenderThreadInstance = true;
|
||||||
return *sInstance;
|
return *sInstance;
|
||||||
}
|
}
|
||||||
@@ -171,7 +172,6 @@ RenderThread::RenderThread()
|
|||||||
, mFunctorManager(WebViewFunctorManager::instance())
|
, mFunctorManager(WebViewFunctorManager::instance())
|
||||||
, mGlobalProfileData(mJankDataMutex) {
|
, mGlobalProfileData(mJankDataMutex) {
|
||||||
Properties::load();
|
Properties::load();
|
||||||
start("RenderThread");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
RenderThread::~RenderThread() {
|
RenderThread::~RenderThread() {
|
||||||
|
|||||||
@@ -171,6 +171,7 @@ private:
|
|||||||
friend class android::uirenderer::WebViewFunctor;
|
friend class android::uirenderer::WebViewFunctor;
|
||||||
friend class android::uirenderer::skiapipeline::VkFunctorDrawHandler;
|
friend class android::uirenderer::skiapipeline::VkFunctorDrawHandler;
|
||||||
friend class android::uirenderer::VectorDrawable::Tree;
|
friend class android::uirenderer::VectorDrawable::Tree;
|
||||||
|
friend class sp<RenderThread>;
|
||||||
|
|
||||||
RenderThread();
|
RenderThread();
|
||||||
virtual ~RenderThread();
|
virtual ~RenderThread();
|
||||||
|
|||||||
Reference in New Issue
Block a user