From dd5ca1940a12a99fa113360f7aeabe5c18e33d59 Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Sat, 16 Mar 2019 13:48:56 +0100 Subject: [PATCH] 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. --- AK/Retainable.h | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/AK/Retainable.h b/AK/Retainable.h index ced4399ffb..fb6a06c4ad 100644 --- a/AK/Retainable.h +++ b/AK/Retainable.h @@ -49,6 +49,12 @@ protected: ASSERT(!m_retain_count); } + void release_base() + { + ASSERT(m_retain_count); + --m_retain_count; + } + int m_retain_count { 1 }; }; @@ -57,8 +63,7 @@ class Retainable : public RetainableBase { public: void release() { - ASSERT(m_retain_count); - --m_retain_count; + release_base(); if (m_retain_count == 0) { call_will_be_destroyed_if_present(static_cast(this)); delete static_cast(this);