Return a null image from ImageExternalTextureGL::CreateEGLImage if an EGL display is not available (flutter/engine#53594)

Previously CreateEGLImage had been failing an assertion if an EGL display is not active on the calling thread.  CreateEGLImage should not assert here because it could be called from a deferred task that runs after the raster thread has lost its EGL state.

See https://github.com/flutter/flutter/issues/149396
This commit is contained in:
Jason Simmons
2024-06-26 15:10:18 -07:00
committed by GitHub
parent 4629bf49ff
commit 0954220cbf

View File

@@ -87,7 +87,11 @@ impeller::UniqueEGLImageKHR ImageExternalTextureGL::CreateEGLImage(
}
EGLDisplay display = eglGetCurrentDisplay();
FML_CHECK(display != EGL_NO_DISPLAY);
if (display == EGL_NO_DISPLAY) {
// This could happen when running in a deferred task that executes after
// the thread has lost its EGL state.
return impeller::UniqueEGLImageKHR();
}
EGLClientBuffer client_buffer =
impeller::android::GetProcTable().eglGetNativeClientBufferANDROID(