diff options
author | Romain Guy <romainguy@google.com> | 2012-04-02 17:49:20 -0700 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2012-04-02 17:49:20 -0700 |
commit | e2eaf6997d429249904f842092b075f3da92c5be (patch) | |
tree | 2187a2a450cdf80d9b1ea10eb53d7d15b09753e6 /libs/hwui | |
parent | 7eae9cb4e732934741c66f3c76a1c1f7d556af43 (diff) | |
parent | 5c88fc744db977ef26887df9605beaa409394806 (diff) | |
download | frameworks_base-e2eaf6997d429249904f842092b075f3da92c5be.zip frameworks_base-e2eaf6997d429249904f842092b075f3da92c5be.tar.gz frameworks_base-e2eaf6997d429249904f842092b075f3da92c5be.tar.bz2 |
Merge "Prevent crash when flushing the layers cache Bug #6258973"
Diffstat (limited to 'libs/hwui')
-rw-r--r-- | libs/hwui/LayerCache.cpp | 12 | ||||
-rw-r--r-- | libs/hwui/LayerRenderer.cpp | 1 | ||||
-rw-r--r-- | libs/hwui/OpenGLRenderer.cpp | 1 |
3 files changed, 12 insertions, 2 deletions
diff --git a/libs/hwui/LayerCache.cpp b/libs/hwui/LayerCache.cpp index d304b37..eea707e 100644 --- a/libs/hwui/LayerCache.cpp +++ b/libs/hwui/LayerCache.cpp @@ -69,10 +69,14 @@ void LayerCache::setMaxSize(uint32_t maxSize) { void LayerCache::deleteLayer(Layer* layer) { if (layer) { - LAYER_LOGD("Destroying layer %dx%d", layer->getWidth(), layer->getHeight()); + GLuint fbo = layer->getFbo(); + LAYER_LOGD("Destroying layer %dx%d, fbo %d", layer->getWidth(), layer->getHeight(), fbo); + mSize -= layer->getWidth() * layer->getHeight() * 4; - layer->deleteFbo(); + + if (fbo) Caches::getInstance().fboCache.put(fbo); layer->deleteTexture(); + delete layer; } } @@ -174,6 +178,10 @@ bool LayerCache::put(Layer* layer) { victim->layer.getHeight()); } + layer->deferredUpdateScheduled = false; + layer->renderer = NULL; + layer->displayList = NULL; + LayerEntry entry(layer); mCache.add(entry); diff --git a/libs/hwui/LayerRenderer.cpp b/libs/hwui/LayerRenderer.cpp index e320eb2..2a4e72b 100644 --- a/libs/hwui/LayerRenderer.cpp +++ b/libs/hwui/LayerRenderer.cpp @@ -309,6 +309,7 @@ void LayerRenderer::destroyLayer(Layer* layer) { if (fbo) { flushLayer(layer); Caches::getInstance().fboCache.put(fbo); + layer->setFbo(0); } if (!Caches::getInstance().layerCache.put(layer)) { diff --git a/libs/hwui/OpenGLRenderer.cpp b/libs/hwui/OpenGLRenderer.cpp index 39be5ed..115787c 100644 --- a/libs/hwui/OpenGLRenderer.cpp +++ b/libs/hwui/OpenGLRenderer.cpp @@ -678,6 +678,7 @@ void OpenGLRenderer::composeLayer(sp<Snapshot> current, sp<Snapshot> previous) { // Put the FBO name back in the cache, if it doesn't fit, it will be destroyed mCaches.fboCache.put(current->fbo); + layer->setFbo(0); } dirtyClip(); |