From 40b832a83815d896be5cc40304d5c0e6b0f8d007 Mon Sep 17 00:00:00 2001 From: Joel Winarske Date: Thu, 28 Sep 2023 13:10:09 -0700 Subject: [PATCH] [Impeller] Fix OpenGLES EGL_BAD_ACCESS due to context being current on multiple threads. (flutter/engine#46287) On Linux setting the EGL context from one thread, then setting from another thread will trigger a EGL_BAD_ACCESS error. The resolution is to clear the context after use on the thread that set it. https://github.com/flutter/flutter/issues/130619 --- .../shell/platform/embedder/embedder_surface_gl_impeller.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engine/src/flutter/shell/platform/embedder/embedder_surface_gl_impeller.cc b/engine/src/flutter/shell/platform/embedder/embedder_surface_gl_impeller.cc index 20a2a5184e..340725d2b9 100644 --- a/engine/src/flutter/shell/platform/embedder/embedder_surface_gl_impeller.cc +++ b/engine/src/flutter/shell/platform/embedder/embedder_surface_gl_impeller.cc @@ -86,13 +86,13 @@ EmbedderSurfaceGLImpeller::EmbedderSurfaceGLImpeller( return; } - worker_->SetReactionsAllowedOnCurrentThread(true); auto worker_id = impeller_context_->AddReactorWorker(worker_); if (!worker_id.has_value()) { FML_LOG(ERROR) << "Could not add reactor worker."; return; } + gl_dispatch_table_.gl_clear_current_callback(); FML_LOG(ERROR) << "Using the Impeller rendering backend (OpenGL)."; valid_ = true; }