diff --git a/shell/platform/ohos/ohos_external_texture_gl.cpp b/shell/platform/ohos/ohos_external_texture_gl.cpp index ad1c4e2d7019e30341d9807c126de637a39df61a..788a215814f7f77956ca14e80acf00bebd2bccd5 100755 --- a/shell/platform/ohos/ohos_external_texture_gl.cpp +++ b/shell/platform/ohos/ohos_external_texture_gl.cpp @@ -86,7 +86,8 @@ void OHOSExternalTextureGL::Attach() int32_t ret = OH_NativeImage_AttachContext(nativeImage_, texture_name_); if (ret != 0) { - FML_DLOG(FATAL)<<"OHOSExternalTextureGL OH_NativeImage_AttachContext err code:"<< ret; + FML_DLOG(FATAL) << "Failed to attach current GL context. ErrorCode:" << ret; + return; } state_ = AttachmentState::attached; } else { @@ -174,7 +175,13 @@ void OHOSExternalTextureGL::OnGrContextDestroyed() void OHOSExternalTextureGL::MarkNewFrameAvailable() { - FML_DLOG(INFO)<<" OHOSExternalTextureGL::MarkNewFrameAvailable"; + FML_DLOG(INFO)<< "OHOSExternalTextureGL::MarkNewFrameAvailable"; + if (state_ == AttachmentState::detached) { + return; + } + if (state_ == AttachmentState::uninitialized) { + Attach(); + } new_frame_ready_ = true; Update(); }