mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 02:37:42 +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
|
@ -5,7 +5,6 @@
|
|||
*/
|
||||
|
||||
#include "EventLoopPluginSerenity.h"
|
||||
#include <AK/Function.h>
|
||||
#include <AK/NonnullRefPtr.h>
|
||||
#include <LibCore/EventLoop.h>
|
||||
#include <LibWeb/Platform/TimerSerenity.h>
|
||||
|
@ -15,12 +14,12 @@ namespace Web::Platform {
|
|||
EventLoopPluginSerenity::EventLoopPluginSerenity() = default;
|
||||
EventLoopPluginSerenity::~EventLoopPluginSerenity() = default;
|
||||
|
||||
void EventLoopPluginSerenity::spin_until(Function<bool()> goal_condition)
|
||||
void EventLoopPluginSerenity::spin_until(JS::SafeFunction<bool()> goal_condition)
|
||||
{
|
||||
Core::EventLoop::current().spin_until(move(goal_condition));
|
||||
}
|
||||
|
||||
void EventLoopPluginSerenity::deferred_invoke(Function<void()> function)
|
||||
void EventLoopPluginSerenity::deferred_invoke(JS::SafeFunction<void()> function)
|
||||
{
|
||||
VERIFY(function);
|
||||
Core::deferred_invoke(move(function));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue