AK: Make sure that Weakable always has the same memory layout

Weakable objects ended up with differing memory layouts in some ports
since they don't build with the DEBUG macro defined.

Instead of forcing ports to define DEBUG, just put this behind a custom
WEAKABLE_DEBUG macro and leave it always-on for now.
This commit is contained in:
Andreas Kling 2020-02-15 14:49:57 +01:00
parent d5e167e725
commit b515ea454f
Notes: sideshowbarker 2024-07-19 09:18:53 +09:00

View file

@ -30,6 +30,8 @@
#include "RefCounted.h"
#include "RefPtr.h"
#define WEAKABLE_DEBUG
namespace AK {
template<typename T>
@ -66,7 +68,7 @@ protected:
~Weakable()
{
#ifdef DEBUG
#ifdef WEAKABLE_DEBUG
m_being_destroyed = true;
#endif
if (m_link)
@ -75,7 +77,7 @@ protected:
private:
RefPtr<WeakLink<T>> m_link;
#ifdef DEBUG
#ifdef WEAKABLE_DEBUG
bool m_being_destroyed { false };
#endif
};