1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 23:17:46 +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:
Andreas Kling 2022-01-11 00:49:00 +01:00
parent a4b3bf1d63
commit 3550f12543

View file

@ -34,6 +34,8 @@ public:
if constexpr (requires { 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;
};