Commit graph

9 commits

Author SHA1 Message Date
Ben Wiederhake
b33b08050a LibCore: Remove unused header in EventReceiver 2026-02-21 19:27:35 +01:00
Tim Ledbetter
2a58b5b608 Revert "LibCore: Use weak ownership in EventReceiver::deferred_invoke"
This reverts commit 1ed94388e9.
2026-01-11 13:54:53 -05:00
ayeteadoe
1ed94388e9 LibCore: Use weak ownership in EventReceiver::deferred_invoke
When test-web has completed running all tests there is a pending
DeferredInvoke in the main threads event queue. For Unix pthread, the
main threads event queue is leaked as the destructor callback in
pthread_key_create is not invoked. For Windows pthreads4w, the
destructor callback is invoked when the main thread is exiting. When
the main threads event queue is destroyed, the pending DeferredInvoke
event is destroyed which causes a leftover WebContentClient reference
to also get destroyed; however, the static WebContentClient::s_clients
HashTable has already been destroyed at this point, so we get a UAF in
the WebContentClient destructor and ASAN reports that error.

The reason why cleaning up the pending deferred invoke results in a
WebContentClient instance also being cleaned up is that class inherits
from IPC::ConnectionBase which is a Core::EventReceiver. The
deferred_invoke() method exposed on event receivers takes a strong
reference to itself to ensure it is still alive by the time the event
loop is ready to execute the function. There are a couple places in
IPC::ConnectionBase::drain_messages_from_peer() that utilized deferred
invocation which is why we have a leftover WebContentClient that has
past its useful lifetime at the end of TestWeb::run_tests().

Instead of holding onto a strong reference when the event has not yet
been processed, we take a weak reference and only grab a strong ref if
the receiver is alive when the event loop is about to execute our
function.
2026-01-10 23:35:51 +01:00
Andreas Kling
aec1f6aa7e LibCore: Remove unused CustomEvent 2025-08-11 16:55:25 +02:00
Andreas Kling
c47e253c60 LibCore: Remove unused "visible for timer purposes" concept
This was a long-unused leftover from SerenityOS.
2025-08-11 16:55:25 +02:00
Andreas Kling
0037df88d5 LibCore: Remove unused ChildEvent 2025-08-11 16:55:25 +02:00
Andreas Kling
75091016d7 LibCore: Remove parent/child concept from EventReceiver
This ownership model is no longer used.
2025-08-11 16:55:25 +02:00
Jelle Raaijmakers
4c88c7445c LibCore: Remove EventReceiver's event filter
This went unused.
2025-07-14 11:54:57 +01:00
Timothy Flynn
93712b24bf Everywhere: Hoist the Libraries folder to the top-level 2024-11-10 12:50:45 +01:00
Renamed from Userland/Libraries/LibCore/EventReceiver.cpp (Browse further)