From d7346c32d69d8b1a21be45066d2a4c8c309c26cd Mon Sep 17 00:00:00 2001 From: chenkeyu Date: Sat, 30 Nov 2024 17:56:20 +0800 Subject: [PATCH] add removeCanPromote Issues: https://gitee.com/openharmony/commonlibrary_c_utils/issues/IB83JV?from=project-issue Signed-off-by: chenkeyu --- base/src/refbase.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/base/src/refbase.cpp b/base/src/refbase.cpp index a39676c..562977c 100644 --- a/base/src/refbase.cpp +++ b/base/src/refbase.cpp @@ -457,6 +457,9 @@ RefBase &RefBase::operator=(const RefBase &) { if (refs_ != nullptr) { refs_->RemoveCallback(); +#ifdef OHOS_PLATFORM + refs_->RemoveCanPromote(); +#endif refs_->DecRefCount(); } @@ -486,6 +489,9 @@ RefBase &RefBase::operator=(RefBase &&other) noexcept if (refs_ != nullptr) { refs_->RemoveCallback(); +#ifdef OHOS_PLATFORM + refs_->RemoveCanPromote(); +#endif refs_->DecRefCount(); } @@ -498,6 +504,9 @@ RefBase::~RefBase() { if (refs_ != nullptr) { refs_->RemoveCallback(); +#ifdef OHOS_PLATFORM + refs_->RemoveCanPromote(); +#endif if ((refs_->IsLifeTimeExtended() && refs_->GetWeakRefCount() == 0) || refs_->GetStrongRefCount() == INITIAL_PRIMARY_VALUE) { refs_->DecRefCount(); -- Gitee