mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-21 23:20:20 +00:00
Kernel: Unbreak ref counting hooks in ListedRefCounted & RefCounted
We have to mind the constness of the pointer when using "requires" to
check if a member function can be invoked.
I regressed this in c4a0f01b02
.
This commit is contained in:
parent
e53571ef59
commit
5871072ed3
Notes:
sideshowbarker
2024-07-17 21:25:41 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/5871072ed3f
2 changed files with 2 additions and 2 deletions
|
@ -25,7 +25,7 @@ class ListedRefCounted : public RefCountedBase {
|
|||
public:
|
||||
bool unref() const
|
||||
{
|
||||
auto const* that = static_cast<T const*>(this);
|
||||
auto* that = const_cast<T*>(static_cast<T const*>(this));
|
||||
|
||||
auto callback = [&](auto& list) {
|
||||
auto new_ref_count = deref_base();
|
||||
|
|
|
@ -69,7 +69,7 @@ class RefCounted : public RefCountedBase {
|
|||
public:
|
||||
bool unref() const
|
||||
{
|
||||
auto const* that = static_cast<T const*>(this);
|
||||
auto* that = const_cast<T*>(static_cast<T const*>(this));
|
||||
auto new_ref_count = deref_base();
|
||||
if (new_ref_count == 0) {
|
||||
if constexpr (requires { that->will_be_destroyed(); })
|
||||
|
|
Loading…
Reference in a new issue