From c8c71096195de0128e57574b1ddf685838ceb2f0 Mon Sep 17 00:00:00 2001 From: Michael Chock Date: Mon, 4 Mar 2013 15:15:46 -0800 Subject: [PATCH] Abort surface composition if hw surface is invalid If an invalid display device is detected during surface composition (e.g., a simulated secondary display is removed), abort the composition. Change-Id: Ia6afb2e287882d8ae0614eb25463d3f85b687adf --- services/surfaceflinger/SurfaceFlinger.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/services/surfaceflinger/SurfaceFlinger.cpp b/services/surfaceflinger/SurfaceFlinger.cpp index 9afa4c12c..055bfe47f 100644 --- a/services/surfaceflinger/SurfaceFlinger.cpp +++ b/services/surfaceflinger/SurfaceFlinger.cpp @@ -1520,7 +1520,11 @@ void SurfaceFlinger::doComposeSurfaces(const sp& hw, const const bool hasGlesComposition = hwc.hasGlesComposition(id) || (cur==end); if (hasGlesComposition) { - DisplayDevice::makeCurrent(mEGLDisplay, hw, mEGLContext); + if (!DisplayDevice::makeCurrent(mEGLDisplay, hw, mEGLContext)) { + ALOGW("DisplayDevice::makeCurrent failed. Aborting surface composition for display %s", + hw->getDisplayName().string()); + return; + } // set the frame buffer glMatrixMode(GL_MODELVIEW);