From 1d5ceda2ea53f333f58d8df35d649936e80bbbc5 Mon Sep 17 00:00:00 2001 From: lengqinjie <15390014138@163.com> Date: Sat, 23 Oct 2021 20:45:37 +0800 Subject: [PATCH 1/2] forgotten decrease the old strong pointer reference Signed-off-by: lengqinjie <15390014138@163.com> --- base/include/refbase.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/base/include/refbase.h b/base/include/refbase.h index 4113a63..10a9625 100755 --- a/base/include/refbase.h +++ b/base/include/refbase.h @@ -336,6 +336,9 @@ template inline sptr &sptr::operator=(const wptr &other) { if ((other != nullptr) && other.AttemptIncStrongRef(this)) { + if (refs_ != nullptr) { + refs_->DecStrongRef(this); + } refs_ = other.GetRefPtr(); } else { refs_ = nullptr; -- Gitee From 4b4c4081a2d19036d8870483b1b9792ca29b1534 Mon Sep 17 00:00:00 2001 From: lengqinjie <15390014138@163.com> Date: Sat, 23 Oct 2021 20:45:37 +0800 Subject: [PATCH 2/2] forgotten decrease the old strong pointer reference Signed-off-by: lengqinjie <15390014138@163.com> --- base/include/refbase.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/base/include/refbase.h b/base/include/refbase.h index 4113a63..10a9625 100755 --- a/base/include/refbase.h +++ b/base/include/refbase.h @@ -336,6 +336,9 @@ template inline sptr &sptr::operator=(const wptr &other) { if ((other != nullptr) && other.AttemptIncStrongRef(this)) { + if (refs_ != nullptr) { + refs_->DecStrongRef(this); + } refs_ = other.GetRefPtr(); } else { refs_ = nullptr; -- Gitee