BAN: Mark RefPtr and WeakPtr helper destructors virtual
Also fix a bug in WeakPtr::lock() which would assert false if the underlying weak link was not initialized
This commit is contained in:
parent
446220494e
commit
cfdce9be61
|
@ -36,7 +36,7 @@ namespace BAN
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
RefCounted() = default;
|
RefCounted() = default;
|
||||||
~RefCounted() { ASSERT(m_ref_count == 0); }
|
virtual ~RefCounted() { ASSERT(m_ref_count == 0); }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
mutable uint32_t m_ref_count = 1;
|
mutable uint32_t m_ref_count = 1;
|
||||||
|
|
|
@ -34,7 +34,7 @@ namespace BAN
|
||||||
class Weakable
|
class Weakable
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
~Weakable()
|
virtual ~Weakable()
|
||||||
{
|
{
|
||||||
if (m_link)
|
if (m_link)
|
||||||
m_link->invalidate();
|
m_link->invalidate();
|
||||||
|
@ -82,7 +82,7 @@ namespace BAN
|
||||||
|
|
||||||
RefPtr<T> lock()
|
RefPtr<T> lock()
|
||||||
{
|
{
|
||||||
if (m_link->valid())
|
if (valid())
|
||||||
return m_link->lock();
|
return m_link->lock();
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue