mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 13:07:47 +00:00
AK: Hoist the assertion in Retainable::release() to RetainableBase.
This means we don't have to generate a __PRETTY_FUNCTION__ symbol there for each and every specialization.
This commit is contained in:
parent
3ebb5fbb87
commit
dd5ca1940a
1 changed files with 7 additions and 2 deletions
|
@ -49,6 +49,12 @@ protected:
|
||||||
ASSERT(!m_retain_count);
|
ASSERT(!m_retain_count);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void release_base()
|
||||||
|
{
|
||||||
|
ASSERT(m_retain_count);
|
||||||
|
--m_retain_count;
|
||||||
|
}
|
||||||
|
|
||||||
int m_retain_count { 1 };
|
int m_retain_count { 1 };
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -57,8 +63,7 @@ class Retainable : public RetainableBase {
|
||||||
public:
|
public:
|
||||||
void release()
|
void release()
|
||||||
{
|
{
|
||||||
ASSERT(m_retain_count);
|
release_base();
|
||||||
--m_retain_count;
|
|
||||||
if (m_retain_count == 0) {
|
if (m_retain_count == 0) {
|
||||||
call_will_be_destroyed_if_present(static_cast<T*>(this));
|
call_will_be_destroyed_if_present(static_cast<T*>(this));
|
||||||
delete static_cast<T*>(this);
|
delete static_cast<T*>(this);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue