Bug 986836 - Don't destroy the native framebuffer's eglSurface on ICS. r=jrmuizel, a=1.4+
☠☠ backed out by 1c796697dca3 ☠ ☠
authorBenoit Jacob <bjacob@mozilla.com>
Fri, 11 Apr 2014 08:38:07 -0400
changeset 192881 7a869c7d9b191849a551ecac7b7b1b5dfc59f484
parent 192880 24e3dcfeccf485d62f11f26dd81b09a2aff063e0
child 192882 73704c34b2fd9b9c3bb7451bb8578899a9c6b15e
push id474
push userasasaki@mozilla.com
push dateMon, 02 Jun 2014 21:01:02 +0000
treeherdermozilla-release@967f4cf1b31c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjrmuizel, 1
bugs986836
milestone30.0a2
Bug 986836 - Don't destroy the native framebuffer's eglSurface on ICS. r=jrmuizel, a=1.4+
gfx/gl/GLContextProviderEGL.cpp
--- a/gfx/gl/GLContextProviderEGL.cpp
+++ b/gfx/gl/GLContextProviderEGL.cpp
@@ -258,16 +258,28 @@ GLContextEGL::~GLContextEGL()
 {
     MarkDestroyed();
 
 #ifdef DEBUG
     printf_stderr("Destroying context %p surface %p on display %p\n", mContext, mSurface, EGL_DISPLAY());
 #endif
 
     sEGLLibrary.fDestroyContext(EGL_DISPLAY(), mContext);
+
+#if defined(MOZ_WIDGET_GONK) && ANDROID_VERSION < 17
+    if (!mIsOffscreen) {
+      // In ICS, SurfaceFlinger's DisplayHardware::fini() does not destroy the EGLSurface associated with the
+      // native framebuffer. Destroying it causes crashes in the ICS emulator
+      // EGL implementation, specifically because the egl_window_surface_t dtor
+      // calls nativeWindow->cancelBuffer and FramebufferNativeWindow does not initialize
+      // the cancelBuffer function pointer, see bug 986836
+      return;
+    }
+#endif
+
     mozilla::gl::DestroySurface(mSurface);
 }
 
 bool
 GLContextEGL::Init()
 {
 #if defined(ANDROID)
     // We can't use LoadApitraceLibrary here because the GLContext