diff options
Diffstat (limited to 'libs')
| -rw-r--r-- | libs/hwui/Caches.h | 2 | ||||
| -rw-r--r-- | libs/hwui/Layer.cpp | 7 |
2 files changed, 8 insertions, 1 deletions
diff --git a/libs/hwui/Caches.h b/libs/hwui/Caches.h index 330dc2951ec9..eac9359beab3 100644 --- a/libs/hwui/Caches.h +++ b/libs/hwui/Caches.h @@ -92,6 +92,8 @@ public: */ bool init(); + bool isInitialized() { return mInitialized; } + /** * Flush the cache. * diff --git a/libs/hwui/Layer.cpp b/libs/hwui/Layer.cpp index 114347d94357..cdbbbab7730d 100644 --- a/libs/hwui/Layer.cpp +++ b/libs/hwui/Layer.cpp @@ -197,7 +197,12 @@ void Layer::generateTexture() { } void Layer::clearTexture() { - caches.textureState().unbindTexture(texture.mId); + // There's a rare possibility that Caches could have been destroyed already + // since this method is queued up as a task. + // Since this is a reset method, treat this as non-fatal. + if (caches.isInitialized()) { + caches.textureState().unbindTexture(texture.mId); + } texture.mId = 0; } |