mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 01:07:36 +00:00
LibCore+Userland: Make Core::Timer::create_single_shot() return ErrorOr
clang-format sure has some interesting opinions about where to put a method call that comes after a lambda. :thonk:
This commit is contained in:
parent
a15d44f019
commit
a8cf0c9371
20 changed files with 42 additions and 36 deletions
|
@ -20,7 +20,7 @@ auto debounce(TFunction function, int timeout)
|
|||
timer->stop();
|
||||
timer->on_timeout = move(apply_function);
|
||||
} else {
|
||||
timer = Core::Timer::create_single_shot(timeout, move(apply_function));
|
||||
timer = Core::Timer::create_single_shot(timeout, move(apply_function)).release_value_but_fixme_should_propagate_errors();
|
||||
}
|
||||
timer->start();
|
||||
};
|
||||
|
|
|
@ -22,9 +22,9 @@ public:
|
|||
timer->stop();
|
||||
return timer;
|
||||
}
|
||||
static NonnullRefPtr<Timer> create_single_shot(int interval_ms, Function<void()>&& timeout_handler, Object* parent = nullptr)
|
||||
static ErrorOr<NonnullRefPtr<Timer>> create_single_shot(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->set_single_shot(true);
|
||||
timer->stop();
|
||||
return timer;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue