mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 00:47:45 +00:00
Kernel: Make ListedRefCounted::unref() call optional list removal helper
Look for remove_from_secondary_lists() and call it on the ref-counting target if present *while the lock is held*. This allows listed-ref-counted objects to be present in multiple lists and still have synchronized removal on final unref.
This commit is contained in:
parent
a4b3bf1d63
commit
3550f12543
1 changed files with 2 additions and 0 deletions
|
@ -34,6 +34,8 @@ public:
|
||||||
if constexpr (requires { that->revoke_weak_ptrs(); }) {
|
if constexpr (requires { that->revoke_weak_ptrs(); }) {
|
||||||
that->revoke_weak_ptrs();
|
that->revoke_weak_ptrs();
|
||||||
}
|
}
|
||||||
|
if constexpr (requires { that->remove_from_secondary_lists(); })
|
||||||
|
that->remove_from_secondary_lists();
|
||||||
}
|
}
|
||||||
return new_ref_count;
|
return new_ref_count;
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue