Allow ~Layer() to happen after onGLContextDestroyed
Bug: 19146354
Change-Id: I9e885936168bd541bfbed4064ad67ab524f58e32
diff --git a/libs/hwui/RenderState.cpp b/libs/hwui/RenderState.cpp
index d1f5f4e..ca640e5 100644
--- a/libs/hwui/RenderState.cpp
+++ b/libs/hwui/RenderState.cpp
@@ -41,6 +41,10 @@
mCaches->textureCache.setAssetAtlas(&mAssetAtlas);
}
+static void layerLostGlContext(Layer* layer) {
+ layer->onGlContextLost();
+}
+
void RenderState::onGLContextDestroyed() {
/*
size_t size = mActiveLayers.size();
@@ -73,6 +77,7 @@
LOG_ALWAYS_FATAL("%d layers have survived gl context destruction", size);
}
*/
+ std::for_each(mActiveLayers.begin(), mActiveLayers.end(), layerLostGlContext);
mAssetAtlas.terminate();
}