diff --git a/shell/platform/ohos/platform_view_ohos.cpp b/shell/platform/ohos/platform_view_ohos.cpp index b66be4705f653a53e68a64f62bb7ea4e20c58db8..aefccf1b5cdc09eda059d2c237bdafaae46cfd09 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 f7cc0778e1d863b586e7ed59dabd4edc13f5b31e..02e7d3754ec5ce6fa13bd9827b0adb9bc4b4a1f0 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();