mirror of
https://github.com/SerenityOS/serenity
synced 2024-10-15 12:23:15 +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
|
@ -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…
Reference in a new issue