mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-12-08 06:09:58 +00:00
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:
parent
970100e789
commit
b572ae95a9
Notes:
github-actions[bot]
2025-12-03 03:21:58 +00:00
Author: https://github.com/Zaggy1024
Commit: b572ae95a9
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/6993
14 changed files with 24 additions and 47 deletions
|
|
@ -210,7 +210,7 @@ public:
|
|||
}
|
||||
}
|
||||
|
||||
ThreadEventQueue::current().post_event(*strong_owner, make<TimerEvent>());
|
||||
ThreadEventQueue::current().post_event(strong_owner, make<TimerEvent>());
|
||||
}
|
||||
|
||||
AK::Duration interval;
|
||||
|
|
@ -314,7 +314,7 @@ void EventLoopImplementationUnix::quit(int code)
|
|||
m_exit_code = code;
|
||||
}
|
||||
|
||||
void EventLoopImplementationUnix::post_event(EventReceiver& receiver, NonnullOwnPtr<Event>&& event)
|
||||
void EventLoopImplementationUnix::post_event(EventReceiver* receiver, NonnullOwnPtr<Event>&& event)
|
||||
{
|
||||
m_thread_event_queue.post_event(receiver, move(event));
|
||||
if (&m_thread_event_queue != &ThreadEventQueue::current())
|
||||
|
|
@ -422,7 +422,7 @@ try_select_again:
|
|||
type &= notifier.type();
|
||||
|
||||
if (type != NotificationType::None)
|
||||
ThreadEventQueue::current().post_event(notifier, make<NotifierActivationEvent>());
|
||||
ThreadEventQueue::current().post_event(¬ifier, make<NotifierActivationEvent>());
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue