From aa602427f625b64279ecd379450d30072bb8e083 Mon Sep 17 00:00:00 2001 From: laoguanyao <806103474@qq.com> Date: Wed, 18 Sep 2024 15:57:42 +0800 Subject: [PATCH] =?UTF-8?q?=E8=BF=98=E5=8E=9Fplatformview=E4=B8=AD?= =?UTF-8?q?=E8=BF=9B=E7=A8=8B=E9=94=81=E7=9A=84=E4=BF=AE=E6=94=B9=EF=BC=8C?= =?UTF-8?q?=E8=A7=84=E9=81=BF=E6=B5=81=E7=A8=8B=E9=A1=BA=E5=BA=8F=E5=87=BA?= =?UTF-8?q?=E7=8E=B0=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: huangxiaoyao <976125628@qq.com> --- shell/platform/ohos/platform_view_ohos.cpp | 10 +++++++++- shell/platform/ohos/platform_view_ohos.h | 1 + 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/shell/platform/ohos/platform_view_ohos.cpp b/shell/platform/ohos/platform_view_ohos.cpp index b66be4705f..aefccf1b5c 100644 --- a/shell/platform/ohos/platform_view_ohos.cpp +++ b/shell/platform/ohos/platform_view_ohos.cpp @@ -181,12 +181,20 @@ void PlatformViewOHOS::NotifyChanged(const SkISize& size) { } } +pthread_mutex_t PlatformViewOHOS::mutex_; + bool PlatformViewOHOS::GetDestroyed() { - return isDestroyed_; + bool ret; + pthread_mutex_lock(&mutex_); + ret = isDestroyed_; + pthread_mutex_unlock(&mutex_); + return ret; } void PlatformViewOHOS::SetDestroyed(bool isDestroyed) { + pthread_mutex_lock(&mutex_); isDestroyed_ = isDestroyed; + pthread_mutex_unlock(&mutex_); } // |PlatformView| diff --git a/shell/platform/ohos/platform_view_ohos.h b/shell/platform/ohos/platform_view_ohos.h index f7cc0778e1..02e7d3754e 100644 --- a/shell/platform/ohos/platform_view_ohos.h +++ b/shell/platform/ohos/platform_view_ohos.h @@ -142,6 +142,7 @@ class PlatformViewOHOS final : public PlatformView { std::map contextDatas_; bool isDestroyed_; + static pthread_mutex_t mutex_; bool GetDestroyed(); -- Gitee