summaryrefslogtreecommitdiffstats
path: root/libs/surfaceflinger/Layer.cpp
diff options
context:
space:
mode:
authorMathias Agopian <mathias@google.com>2009-12-10 15:52:29 -0800
committerMathias Agopian <mathias@google.com>2009-12-10 15:59:08 -0800
commit8f03b47432f007b1fb3438608361ebf4e3a1310b (patch)
treec2971689ed314285bc32d7b226e51cf364e9373f /libs/surfaceflinger/Layer.cpp
parentc0012deacc14f871062ebc1756d5290d8a8b5ad3 (diff)
downloadframeworks_native-8f03b47432f007b1fb3438608361ebf4e3a1310b.zip
frameworks_native-8f03b47432f007b1fb3438608361ebf4e3a1310b.tar.gz
frameworks_native-8f03b47432f007b1fb3438608361ebf4e3a1310b.tar.bz2
fix [2319255] crash in openGL : from the media recorder stress test.
never call eglCreateImageKHR() with a NULL native buffer, which can happen in OOM conditions.
Diffstat (limited to 'libs/surfaceflinger/Layer.cpp')
-rw-r--r--libs/surfaceflinger/Layer.cpp9
1 files changed, 8 insertions, 1 deletions
diff --git a/libs/surfaceflinger/Layer.cpp b/libs/surfaceflinger/Layer.cpp
index f11bf18..b12c749 100644
--- a/libs/surfaceflinger/Layer.cpp
+++ b/libs/surfaceflinger/Layer.cpp
@@ -134,7 +134,14 @@ void Layer::reloadTexture(const Region& dirty)
{
Mutex::Autolock _l(mLock);
sp<GraphicBuffer> buffer(getFrontBufferLocked());
- int index = mFrontBufferIndex;
+ if (buffer == NULL) {
+ // this situation can happen if we ran out of memory for instance.
+ // not much we can do. continue to use whatever texture was bound
+ // to this context.
+ return;
+ }
+
+ const int index = mFrontBufferIndex;
// create the new texture name if needed
if (UNLIKELY(mTextures[index].name == -1U)) {