1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 01:37:36 +00:00

LibCore+Userland: Make Core::Timer::create_repeating() return ErrorOr

The FIXMEs must flow!
This commit is contained in:
Sam Atkins 2023-01-11 16:20:17 +00:00 committed by Andreas Kling
parent 1d4f287582
commit a15d44f019
12 changed files with 19 additions and 17 deletions

View file

@ -16,9 +16,9 @@ class Timer final : public Object {
C_OBJECT(Timer);
public:
static NonnullRefPtr<Timer> create_repeating(int interval_ms, Function<void()>&& timeout_handler, Object* parent = nullptr)
static ErrorOr<NonnullRefPtr<Timer>> create_repeating(int interval_ms, Function<void()>&& timeout_handler, Object* parent = nullptr)
{
auto timer = adopt_ref(*new Timer(interval_ms, move(timeout_handler), parent));
auto timer = TRY(adopt_nonnull_ref_or_enomem(new Timer(interval_ms, move(timeout_handler), parent)));
timer->stop();
return timer;
}