From ed6897495fe75af1059788e5206ea732be717d71 Mon Sep 17 00:00:00 2001 From: liujiake Date: Wed, 4 Dec 2024 22:45:41 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A4=96=E6=8E=A5=E7=BA=B9=E7=90=86attach?= =?UTF-8?q?=E4=B8=AD=E5=A2=9E=E5=8A=A0=E5=88=A4=E6=96=AD=EF=BC=8C=E8=8B=A5?= =?UTF-8?q?=E5=BD=93=E5=89=8Donscreen=5Fsurface=E4=B8=BA=E7=A9=BA=EF=BC=8C?= =?UTF-8?q?=E5=88=99=E7=9B=B4=E6=8E=A5=E8=BF=94=E5=9B=9E=E3=80=82=20?= =?UTF-8?q?=E8=A7=A3=E5=86=B3release=E6=A8=A1=E5=BC=8F=E4=B8=ADsurfece?= =?UTF-8?q?=E6=9C=AA=E5=87=86=E5=A4=87=E5=A5=BD=E5=B0=B1=E8=BF=9B=E8=A1=8C?= =?UTF-8?q?=E7=BB=91=E5=AE=9A=E5=AF=BC=E8=87=B4=E7=9A=84=E9=97=AA=E9=80=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: liujiake --- shell/platform/ohos/ohos_external_texture_gl.cpp | 4 ++++ shell/platform/ohos/ohos_external_texture_gl.h | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/shell/platform/ohos/ohos_external_texture_gl.cpp b/shell/platform/ohos/ohos_external_texture_gl.cpp index a113f3763b..199a20cbc6 100755 --- a/shell/platform/ohos/ohos_external_texture_gl.cpp +++ b/shell/platform/ohos/ohos_external_texture_gl.cpp @@ -160,6 +160,10 @@ void OHOSExternalTextureGL::Attach() } OHOSSurface* ohos_surface_ptr = ohos_surface_.get(); OhosSurfaceGLSkia* ohosSurfaceGLSkia_ = (OhosSurfaceGLSkia*)ohos_surface_ptr; + if (ohosSurfaceGLSkia_->GetOnscreenSurface() == nullptr) { + FML_LOG(WARNING) << "onscreen_surface_ is null, Attach failed"; + return; + } auto result = ohosSurfaceGLSkia_->GLContextMakeCurrent(); if (result->GetResult()) { FML_DLOG(INFO) << "ResourceContextMakeCurrent successed"; diff --git a/shell/platform/ohos/ohos_external_texture_gl.h b/shell/platform/ohos/ohos_external_texture_gl.h index 6e7b35e11e..92c7edda71 100755 --- a/shell/platform/ohos/ohos_external_texture_gl.h +++ b/shell/platform/ohos/ohos_external_texture_gl.h @@ -100,7 +100,7 @@ class OHOSExternalTextureGL : public flutter::Texture { void ProducePixelMapToBackGroundImage(); - enum class AttachmentState { uninitialized, attached, detached, }; + enum class AttachmentState { uninitialized, attached, detached }; AttachmentState state_; -- Gitee