From 24cdcfb4bd0ce631662449d20ee8bcdc5b4aaa39 Mon Sep 17 00:00:00 2001 From: dujingcheng Date: Wed, 28 Jul 2021 15:18:03 +0800 Subject: [PATCH] hanfeng6@huawei.com Signed-off-by: dujingcheng --- frameworks/core/components/camera/camera.cpp | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/frameworks/core/components/camera/camera.cpp b/frameworks/core/components/camera/camera.cpp index 98c3c587..2481d880 100644 --- a/frameworks/core/components/camera/camera.cpp +++ b/frameworks/core/components/camera/camera.cpp @@ -459,10 +459,19 @@ void CameraCallback::Capture(Size photoSize) void CameraCallback::Release() { + LOGI("CameraCallback: Release start."); if (capSession_ != nullptr) { capSession_->Release(); capSession_ = nullptr; } + + if (subWindow_) { + LOGI("CameraCallback: Destroy subWindow."); + subWindow_.reset(); + auto context = context_.Upgrade(); + context->ClipRootHole(0, 0, 0, 0); + } + LOGI("CameraCallback: Release end."); } void CameraCallback::Stop(bool isClosePreView) @@ -472,12 +481,6 @@ void CameraCallback::Stop(bool isClosePreView) } previewState_ = State::STATE_IDLE; - if (isClosePreView && subWindow_) { - LOGI("CameraCallback: Destroy subWindow."); - subWindow_.reset(); - auto context = context_.Upgrade(); - context->ClipRootHole(0, 0, 0, 0); - } } void CameraCallback::AddTakePhotoListener(TakePhotoListener&& listener)