1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 12:57:35 +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

@ -89,7 +89,7 @@ ClockSettingsWidget::ClockSettingsWidget()
m_clock_preview_update_timer = Core::Timer::create_repeating(1000, [&]() {
update_clock_preview();
});
}).release_value_but_fixme_should_propagate_errors();
m_clock_preview_update_timer->start();
update_clock_preview();
}

View file

@ -250,7 +250,7 @@ void MonitorSettingsWidget::apply_settings()
if (seconds_until_revert <= 0) {
box->close();
}
});
}).release_value_but_fixme_should_propagate_errors();
revert_timer->start();
// If the user selects "No", closes the window or the window gets closed by the 10 seconds timer, revert the changes.

View file

@ -37,10 +37,10 @@ ErrorOr<void> HighlightPreviewWidget::reload_cursor()
m_cursor_params = Gfx::CursorParams::parse_from_filename(cursor_path, m_cursor_bitmap->rect().center()).constrained(*m_cursor_bitmap);
// Setup cursor animation:
if (m_cursor_params.frames() > 1 && m_cursor_params.frame_ms() > 0) {
m_frame_timer = Core::Timer::create_repeating(m_cursor_params.frame_ms(), [&] {
m_frame_timer = TRY(Core::Timer::create_repeating(m_cursor_params.frame_ms(), [&] {
m_cursor_frame = (m_cursor_frame + 1) % m_cursor_params.frames();
update();
});
}));
m_frame_timer->start();
} else {
m_frame_timer = nullptr;

View file

@ -51,7 +51,7 @@ ImageEditor::ImageEditor(NonnullRefPtr<Image> image)
m_marching_ants_offset %= (marching_ant_length * 2);
if (!m_image->selection().is_empty() || m_image->selection().in_interactive_selection())
update();
});
}).release_value_but_fixme_should_propagate_errors();
m_marching_ants_timer->start();
}

View file

@ -453,9 +453,9 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
TRY(Core::System::unveil("/tmp/session/%sid/portal/config", "rw"));
TRY(Core::System::unveil(nullptr, nullptr));
auto modified_state_check_timer = Core::Timer::create_repeating(500, [&] {
auto modified_state_check_timer = TRY(Core::Timer::create_repeating(500, [&] {
window->set_modified(tty_has_foreground_process() || shell_child_process_count() > 0);
});
}));
listener.on_confirm_close_changed = [&](bool confirm_close) {
if (confirm_close) {