From 00651b26ea597ed3425a75e88ffb3db568b29b73 Mon Sep 17 00:00:00 2001 From: Emmanuel Garcia Date: Wed, 10 Jun 2020 20:29:04 -0700 Subject: [PATCH] Call destructor and fix check (flutter/engine#18985) --- .../src/flutter/shell/platform/android/android_surface_gl.cc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/engine/src/flutter/shell/platform/android/android_surface_gl.cc b/engine/src/flutter/shell/platform/android/android_surface_gl.cc index 434ad08dda..8b91867dd3 100644 --- a/engine/src/flutter/shell/platform/android/android_surface_gl.cc +++ b/engine/src/flutter/shell/platform/android/android_surface_gl.cc @@ -57,8 +57,11 @@ bool AndroidSurfaceGL::OnScreenSurfaceResize(const SkISize& size) { android_context_->ClearCurrent(); + // Ensure the destructor is called since it destroys the `EGLSurface` before + // creating a new onscreen surface. + onscreen_surface_ = nullptr; onscreen_surface_ = android_context_->CreateOnscreenSurface(native_window_); - if (onscreen_surface_->IsValid()) { + if (!onscreen_surface_->IsValid()) { FML_LOG(ERROR) << "Unable to create EGL window surface on resize."; return false; }