mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 06:48:12 +00:00
LibWeb+Browser+Ladybird: Use JS::SafeFunction for EventLoop callbacks
This automatically protects captured objects from being GC'd before the callback runs.
This commit is contained in:
parent
892470a912
commit
6d93e03211
11 changed files with 19 additions and 19 deletions
|
@ -56,9 +56,9 @@ void PendingResponse::run_callback()
|
|||
{
|
||||
VERIFY(m_callback);
|
||||
VERIFY(m_response);
|
||||
Platform::EventLoopPlugin::the().deferred_invoke([strong_this = JS::make_handle(*this)] {
|
||||
strong_this->m_callback(*strong_this->m_response);
|
||||
strong_this->m_request->remove_pending_response({}, *strong_this.ptr());
|
||||
Platform::EventLoopPlugin::the().deferred_invoke([this] {
|
||||
m_callback(*m_response);
|
||||
m_request->remove_pending_response({}, *this);
|
||||
});
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue