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:
Andreas Kling 2022-01-08 17:25:37 +01:00
parent e53571ef59
commit 5871072ed3
2 changed files with 2 additions and 2 deletions

View file

@ -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();

View file

@ -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(); })