diff options
author | Andreas Kling <kling@serenityos.org> | 2020-07-04 16:22:32 +0200 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2020-07-04 16:23:52 +0200 |
commit | f7577585a6794228659e5e7b496cddfd8a94b54d (patch) | |
tree | da024c0df21b4cab3b2e5886d31e07667f8bc5b2 /AK/Weakable.h | |
parent | 1dd15950439f4027f6412bb3748f7f433e60924b (diff) | |
download | serenity-f7577585a6794228659e5e7b496cddfd8a94b54d.zip |
AK: Add Weakable::revoke_weak_ptrs()
This allows you to clear all the WeakPtrs pointing at a Weakable *now*
instead of waiting until the Weakable is destroyed.
Diffstat (limited to 'AK/Weakable.h')
-rw-r--r-- | AK/Weakable.h | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/AK/Weakable.h b/AK/Weakable.h index 0e438b0ff2..960b2a57c3 100644 --- a/AK/Weakable.h +++ b/AK/Weakable.h @@ -71,6 +71,11 @@ protected: #ifdef WEAKABLE_DEBUG m_being_destroyed = true; #endif + revoke_weak_ptrs(); + } + + void revoke_weak_ptrs() + { if (m_link) m_link->m_ptr = nullptr; } |