1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-14 08:14:58 +00:00
serenity/Kernel/Library
Andreas Kling b86443f0e1 Kernel: Lock weak pointer revocation during listed-ref-counted unref
When doing the last unref() on a listed-ref-counted object, we keep
the list locked while mutating the ref count. The destructor itself
is invoked after unlocking the list.

This was racy with weakable classes, since their weak pointer factory
still pointed to the object after we'd decided to destroy it. That
opened a small time window where someone could try to strong-ref a weak
pointer to an object after it was removed from the list, but just before
the destructor got invoked.

This patch closes the race window by explicitly revoking all weak
pointers while the list is locked.
2022-01-08 16:31:14 +01:00
..
ListedRefCounted.h Kernel: Lock weak pointer revocation during listed-ref-counted unref 2022-01-08 16:31:14 +01:00
ThreadSafeNonnullRefPtr.h Kernel: Mark kernel smart-pointer classes as [[nodiscard]] 2021-12-05 15:31:03 +01:00
ThreadSafeRefCounted.h AK+Kernel: Use requires expression when invoking ref counting hooks 2022-01-08 16:31:14 +01:00
ThreadSafeRefPtr.h Kernel: Mark kernel smart-pointer classes as [[nodiscard]] 2021-12-05 15:31:03 +01:00
ThreadSafeWeakPtr.h Kernel: Mark kernel smart-pointer classes as [[nodiscard]] 2021-12-05 15:31:03 +01:00