diff options
author | Stan Iliev <stani@google.com> | 2018-03-01 15:51:17 -0500 |
---|---|---|
committer | Stan Iliev <stani@google.com> | 2018-03-02 14:41:08 +0000 |
commit | 6c4b6e8b0e30a9dee2decb0b5d84285be03febeb (patch) | |
tree | 34d6581b08a1dd75fb97e2ccee12fed28657a96a /libs/hwui/renderthread/RenderProxy.cpp | |
parent | 3eef2efe40d9c783a74174b929535a2569424af1 (diff) |
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
Diffstat (limited to 'libs/hwui/renderthread/RenderProxy.cpp')
-rw-r--r-- | libs/hwui/renderthread/RenderProxy.cpp | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/libs/hwui/renderthread/RenderProxy.cpp b/libs/hwui/renderthread/RenderProxy.cpp index 4be7a57daedf..c6a9b55f8ac1 100644 --- a/libs/hwui/renderthread/RenderProxy.cpp +++ b/libs/hwui/renderthread/RenderProxy.cpp @@ -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]() { - thread.cacheManager().acquireVectorDrawableAtlas()->delayedReleaseEntries(); + // The context may be null if trimMemory executed, but then the atlas was deleted too. + if (thread.getGrContext() != nullptr) { + thread.cacheManager().acquireVectorDrawableAtlas()->delayedReleaseEntries(); + } }); } |