Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f3aba6ee authored by Steven Moreland's avatar Steven Moreland Committed by Android (Google) Code Review
Browse files

Merge "libhwui: RenderThread: fix UAF" into sc-dev

parents 61605574 76ec3822
Loading
Loading
Loading
Loading
+5 −5
Original line number Diff line number Diff line
@@ -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() {
+1 −0
Original line number Diff line number Diff line
@@ -171,6 +171,7 @@ private:
    friend class android::uirenderer::WebViewFunctor;
    friend class android::uirenderer::skiapipeline::VkFunctorDrawHandler;
    friend class android::uirenderer::VectorDrawable::Tree;
    friend class sp<RenderThread>;

    RenderThread();
    virtual ~RenderThread();