diff --git a/base/include/refbase.h b/base/include/refbase.h index 4113a63f47726b55d7d7e8beaa126aa34d7dcfd6..10a9625f1eae3f8ba8952466fb6162afd1d95107 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;