mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 08:47:34 +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
2 changed files with 2 additions and 2 deletions
|
@ -25,7 +25,7 @@ class ListedRefCounted : public RefCountedBase {
|
||||||
public:
|
public:
|
||||||
bool unref() const
|
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 callback = [&](auto& list) {
|
||||||
auto new_ref_count = deref_base();
|
auto new_ref_count = deref_base();
|
||||||
|
|
|
@ -69,7 +69,7 @@ class RefCounted : public RefCountedBase {
|
||||||
public:
|
public:
|
||||||
bool unref() const
|
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();
|
auto new_ref_count = deref_base();
|
||||||
if (new_ref_count == 0) {
|
if (new_ref_count == 0) {
|
||||||
if constexpr (requires { that->will_be_destroyed(); })
|
if constexpr (requires { that->will_be_destroyed(); })
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue