From 332832d84c64f2f7f8942f8df12d8cf7290253e9 Mon Sep 17 00:00:00 2001 From: Jason Simmons Date: Mon, 30 Jul 2018 09:52:39 -0700 Subject: [PATCH] Clear the EGL context only if our context is currently active (flutter/engine#5895) Fixes https://github.com/flutter/flutter/issues/19566 --- .../src/flutter/shell/platform/android/android_context_gl.cc | 3 +++ 1 file changed, 3 insertions(+) diff --git a/engine/src/flutter/shell/platform/android/android_context_gl.cc b/engine/src/flutter/shell/platform/android/android_context_gl.cc index 08744ace7b..b61f4ec743 100644 --- a/engine/src/flutter/shell/platform/android/android_context_gl.cc +++ b/engine/src/flutter/shell/platform/android/android_context_gl.cc @@ -222,6 +222,9 @@ bool AndroidContextGL::MakeCurrent() { } bool AndroidContextGL::ClearCurrent() { + if (eglGetCurrentContext() != context_) { + return true; + } if (eglMakeCurrent(environment_->Display(), EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT) != EGL_TRUE) { FML_LOG(ERROR) << "Could not clear the current context";