mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 07:37:46 +00:00
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:
parent
d5e167e725
commit
b515ea454f
1 changed files with 4 additions and 2 deletions
|
@ -30,6 +30,8 @@
|
||||||
#include "RefCounted.h"
|
#include "RefCounted.h"
|
||||||
#include "RefPtr.h"
|
#include "RefPtr.h"
|
||||||
|
|
||||||
|
#define WEAKABLE_DEBUG
|
||||||
|
|
||||||
namespace AK {
|
namespace AK {
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
|
@ -66,7 +68,7 @@ protected:
|
||||||
|
|
||||||
~Weakable()
|
~Weakable()
|
||||||
{
|
{
|
||||||
#ifdef DEBUG
|
#ifdef WEAKABLE_DEBUG
|
||||||
m_being_destroyed = true;
|
m_being_destroyed = true;
|
||||||
#endif
|
#endif
|
||||||
if (m_link)
|
if (m_link)
|
||||||
|
@ -75,7 +77,7 @@ protected:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
RefPtr<WeakLink<T>> m_link;
|
RefPtr<WeakLink<T>> m_link;
|
||||||
#ifdef DEBUG
|
#ifdef WEAKABLE_DEBUG
|
||||||
bool m_being_destroyed { false };
|
bool m_being_destroyed { false };
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue