diff --git a/shell/platform/ohos/ohos_external_texture_gl.cpp b/shell/platform/ohos/ohos_external_texture_gl.cpp index f160e09469ace687db0b6cd5c68f5cf8cd91e85a..1a5b304ad0f3868cd90d0593b2566edc6496d0d2 100755 --- a/shell/platform/ohos/ohos_external_texture_gl.cpp +++ b/shell/platform/ohos/ohos_external_texture_gl.cpp @@ -343,7 +343,7 @@ bool OHOSExternalTextureGL::IsContextCurrent() void OHOSExternalTextureGL::Update() { FML_DLOG(INFO) << "OHOSExternalTextureGL::Update, texture_name_=" << texture_name_; - if (!IsContextCurrent() && context_) { + if (!IsContextCurrent() && context_ && display_ && draw_surface_ && read_surface_) { if (eglMakeCurrent(display_, draw_surface_, read_surface_, context_) != EGL_TRUE) { FML_LOG(WARNING) << "eglMakeCurrent in update failed"; } diff --git a/shell/platform/ohos/platform_view_ohos.cpp b/shell/platform/ohos/platform_view_ohos.cpp index b1aca3a69c025b1c28c7870d49ea4e43f4af1521..58b10569785d039ecaa48c69236ba243a524a359 100644 --- a/shell/platform/ohos/platform_view_ohos.cpp +++ b/shell/platform/ohos/platform_view_ohos.cpp @@ -117,15 +117,14 @@ PlatformViewOHOS::PlatformViewOHOS( PlatformViewOHOS::~PlatformViewOHOS() { FML_LOG(INFO) << "PlatformViewOHOS::~PlatformViewOHOS"; - for (std::map>::iterator it = external_texture_gl_.begin(); - it != external_texture_gl_.end(); ++it) { - if (it->second != nullptr) { - OH_NativeImage_Destroy(&(it->second->nativeImage_)); - it->second->nativeImage_ = nullptr; + for (auto const &it : external_texture_gl_) { + if (it.second != nullptr) { + FML_LOG(INFO) << " nativeImage of textureId " << it.first << " will destroy"; + OH_NativeImage_Destroy(&(it.second->nativeImage_)); + it.second->nativeImage_ = nullptr; } } external_texture_gl_.clear(); - FML_LOG(INFO) << "PlatformViewOHOS::~PlatformViewOHOS finish"; } void PlatformViewOHOS::NotifyCreate(