From f58f36e3bfc396291cc12ecf931c8e50f9934324 Mon Sep 17 00:00:00 2001 From: lengqinjie <15390014138@163.com> Date: Sat, 23 Oct 2021 21:54:28 +0800 Subject: [PATCH 1/3] forgotten decrease reference of strong pointer 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..1cd6189 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 04c4944abbe2886d9d14a7810c9d54979ed34ae6 Mon Sep 17 00:00:00 2001 From: lengqinjie <15390014138@163.com> Date: Sat, 23 Oct 2021 22:09:11 +0800 Subject: [PATCH 2/3] forgotten decrease reference of strong pointer Signed-off-by: lengqinjie <15390014138@163.com> --- base/include/refbase.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/base/include/refbase.h b/base/include/refbase.h index 1cd6189..5193a72 100755 --- a/base/include/refbase.h +++ b/base/include/refbase.h @@ -336,9 +336,9 @@ template inline sptr &sptr::operator=(const wptr &other) { if ((other != nullptr) && other.AttemptIncStrongRef(this)) { - if (refs_ != nullptr) { - refs_->DecStrongRef(this); - } + if (refs_ != nullptr) { + refs_->DecStrongRef(this); + } refs_ = other.GetRefPtr(); } else { refs_ = nullptr; -- Gitee From a3e8d67f84e78e7c1d4c3e927e961aa1f06189ef Mon Sep 17 00:00:00 2001 From: lengqinjie <15390014138@163.com> Date: Sun, 24 Oct 2021 07:00:33 +0800 Subject: [PATCH 3/3] forgotten decrease the reference of strong pointer Signed-off-by: lengqinjie <15390014138@163.com> --- base/include/refbase.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/base/include/refbase.h b/base/include/refbase.h index 5193a72..4b2b0d0 100755 --- a/base/include/refbase.h +++ b/base/include/refbase.h @@ -335,10 +335,10 @@ inline sptr &sptr::operator=(const sptr &other) template inline sptr &sptr::operator=(const wptr &other) { + if (refs_ != nullptr) { + refs_->DecStrongRef(this); + } if ((other != nullptr) && other.AttemptIncStrongRef(this)) { - if (refs_ != nullptr) { - refs_->DecStrongRef(this); - } refs_ = other.GetRefPtr(); } else { refs_ = nullptr; -- Gitee