diff --git a/shell/platform/ohos/ohos_external_texture_gl.cpp b/shell/platform/ohos/ohos_external_texture_gl.cpp index e369bd0689e7745aaf01d9a297c0c14721449339..8d993a806cbee82127aedbe6d54e21264924a76f 100755 --- a/shell/platform/ohos/ohos_external_texture_gl.cpp +++ b/shell/platform/ohos/ohos_external_texture_gl.cpp @@ -442,9 +442,6 @@ void OHOSExternalTextureGL::Detach() OH_NativeImage_UnsetOnFrameAvailableListener(nativeImage_); OH_NativeImage_Destroy(&nativeImage_); nativeImage_ = nullptr; - } - if (nativeWindow_ != nullptr) { - OH_NativeWindow_DestroyNativeWindow(nativeWindow_); nativeWindow_ = nullptr; } @@ -454,11 +451,9 @@ void OHOSExternalTextureGL::Detach() } OH_NativeImage_Destroy(&backGroundNativeImage_); backGroundNativeImage_ = nullptr; - } - if (backGroundNativeWindow_ != nullptr) { - OH_NativeWindow_DestroyNativeWindow(backGroundNativeWindow_); backGroundNativeWindow_ = nullptr; } + if (state_ == AttachmentState::attached) { glDeleteTextures(1, &texture_name_); glDeleteTextures(1, &backGroundTextureName_);