From 2f59bcc90e0a79abcc9394014c3a1ba6277bfa0f Mon Sep 17 00:00:00 2001 From: Emmanuel Garcia Date: Wed, 10 Jun 2020 19:39:51 -0700 Subject: [PATCH] Call destructor and fix check --- shell/platform/android/android_surface_gl.cc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/shell/platform/android/android_surface_gl.cc b/shell/platform/android/android_surface_gl.cc index 434ad08dda268..8b91867dd3f0e 100644 --- a/shell/platform/android/android_surface_gl.cc +++ b/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; }