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

Commit 6c4b6e8b authored by Stan Iliev's avatar Stan Iliev
Browse files

Fix a crash when grContext was deleted

Fix a crash when trimMemory has occurred and then a java
VectorDrawable object is deleted.

Test: Ran Camera app
Bug: 72837472
Change-Id: I4bdc5975a9ceccc09af17edd9905345f97c2660f
parent 3eef2efe
Loading
Loading
Loading
Loading
+9 −2
Original line number Diff line number Diff line
@@ -356,14 +356,21 @@ void RenderProxy::disableVsync() {
void RenderProxy::repackVectorDrawableAtlas() {
    RenderThread& thread = RenderThread::getInstance();
    thread.queue().post([&thread]() {
        thread.cacheManager().acquireVectorDrawableAtlas()->repackIfNeeded(thread.getGrContext());
        // The context may be null if trimMemory executed, but then the atlas was deleted too.
        if (thread.getGrContext() != nullptr) {
            thread.cacheManager().acquireVectorDrawableAtlas()->repackIfNeeded(
                    thread.getGrContext());
        }
    });
}

void RenderProxy::releaseVDAtlasEntries() {
    RenderThread& thread = RenderThread::getInstance();
    thread.queue().post([&thread]() {
        // The context may be null if trimMemory executed, but then the atlas was deleted too.
        if (thread.getGrContext() != nullptr) {
            thread.cacheManager().acquireVectorDrawableAtlas()->delayedReleaseEntries();
        }
    });
}