LibCore+LibWeb: Remove the dummy EventReceiver from deferred_invoke()

The DeferredInvocationContext only existed to satisfy the requirement
in ThreadEventQueue that each event has an EventReceiver. However,
deferred_invoke() was not even using the EventReceiver to call its
callback. Therefore, we don't need to allocate one for every deferred
invocation.

This also prevents WeakPtr::strong_ref() from racing and leaking the
context object when invoking a function across threads.
This commit is contained in:
Zaggy1024
2025-12-02 01:31:00 -06:00
committed by Gregory Bertilson
parent 970100e789
commit b572ae95a9
Notes: github-actions[bot] 2025-12-03 03:21:58 +00:00
14 changed files with 24 additions and 47 deletions

View File

@@ -6,6 +6,7 @@
#pragma once
#include <AK/NonnullOwnPtr.h>
#include <AK/Time.h>
#include <LibCore/EventLoopImplementation.h>
@@ -50,7 +51,7 @@ public:
virtual void wake() override;
virtual void post_event(EventReceiver& receiver, NonnullOwnPtr<Event>&&) override;
virtual void post_event(EventReceiver*, NonnullOwnPtr<Event>&&) override;
private:
bool m_exit_requested { false };