diff options
20 files changed, 42 insertions, 36 deletions
diff --git a/Tests/LibCore/TestLibCoreDeferredInvoke.cpp b/Tests/LibCore/TestLibCoreDeferredInvoke.cpp index 097d22ab5e..906b6e8aba 100644 --- a/Tests/LibCore/TestLibCoreDeferredInvoke.cpp +++ b/Tests/LibCore/TestLibCoreDeferredInvoke.cpp @@ -12,10 +12,10 @@ TEST_CASE(deferred_invoke) { Core::EventLoop event_loop; - auto reaper = Core::Timer::create_single_shot(250, [] { + auto reaper = MUST(Core::Timer::create_single_shot(250, [] { warnln("I waited for the deferred_invoke to happen, but it never did!"); VERIFY_NOT_REACHED(); - }); + })); Core::deferred_invoke([&event_loop] { event_loop.quit(0); diff --git a/Tests/LibCore/TestLibCoreFileWatcher.cpp b/Tests/LibCore/TestLibCoreFileWatcher.cpp index 6876cc59fd..6e4b499634 100644 --- a/Tests/LibCore/TestLibCoreFileWatcher.cpp +++ b/Tests/LibCore/TestLibCoreFileWatcher.cpp @@ -39,21 +39,21 @@ TEST_CASE(file_watcher_child_events) event_count++; }; - auto timer1 = Core::Timer::create_single_shot(500, [&] { + auto timer1 = MUST(Core::Timer::create_single_shot(500, [&] { int rc = creat("/tmp/testfile", 0777); EXPECT_NE(rc, -1); - }); + })); timer1->start(); - auto timer2 = Core::Timer::create_single_shot(1000, [&] { + auto timer2 = MUST(Core::Timer::create_single_shot(1000, [&] { int rc = unlink("/tmp/testfile"); EXPECT_NE(rc, -1); - }); + })); timer2->start(); - auto catchall_timer = Core::Timer::create_single_shot(2000, [&] { + auto catchall_timer = MUST(Core::Timer::create_single_shot(2000, [&] { VERIFY_NOT_REACHED(); - }); + })); catchall_timer->start(); event_loop.exec(); diff --git a/Userland/Applications/Assistant/main.cpp b/Userland/Applications/Assistant/main.cpp index 503df2583d..4be33eaaaa 100644 --- a/Userland/Applications/Assistant/main.cpp +++ b/Userland/Applications/Assistant/main.cpp @@ -233,7 +233,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments) GUI::Application::the()->quit(); }; - auto update_ui_timer = Core::Timer::create_single_shot(10, [&] { + auto update_ui_timer = TRY(Core::Timer::create_single_shot(10, [&] { results_container.remove_all_children(); results_layout.set_margins(app_state.visible_result_count ? GUI::Margins { 4, 0, 0, 0 } : GUI::Margins { 0 }); @@ -251,7 +251,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments) mark_selected_item(); Core::deferred_invoke([&] { window->resize(GUI::Desktop::the().rect().width() / 3, {}); }); - }); + })); db.on_new_results = [&](auto results) { if (results.is_empty()) diff --git a/Userland/Applications/PixelPaint/Filters/Filter.cpp b/Userland/Applications/PixelPaint/Filters/Filter.cpp index 90afed0605..99172caf66 100644 --- a/Userland/Applications/PixelPaint/Filters/Filter.cpp +++ b/Userland/Applications/PixelPaint/Filters/Filter.cpp @@ -17,7 +17,7 @@ Filter::Filter(ImageEditor* editor) , m_update_timer(Core::Timer::create_single_shot(100, [&] { if (on_settings_change) on_settings_change(); - })) + }).release_value_but_fixme_should_propagate_errors()) { m_update_timer->set_active(false); } diff --git a/Userland/Games/Hearts/Game.cpp b/Userland/Games/Hearts/Game.cpp index 4afcdb770f..79b774286c 100644 --- a/Userland/Games/Hearts/Game.cpp +++ b/Userland/Games/Hearts/Game.cpp @@ -28,7 +28,7 @@ Game::Game() m_delay_timer = Core::Timer::create_single_shot(0, [this] { dbgln_if(HEARTS_DEBUG, "Continuing game after delay..."); advance_game(); - }); + }).release_value_but_fixme_should_propagate_errors(); constexpr int card_overlap = 20; constexpr int outer_border_size = 15; @@ -155,7 +155,7 @@ void Game::show_score_card(bool game_over) if (!m_players[0].is_human) { close_timer = Core::Timer::create_single_shot(2000, [&] { score_dialog->close(); - }); + }).release_value_but_fixme_should_propagate_errors(); close_timer->start(); } @@ -236,7 +236,7 @@ void Game::start_animation(NonnullRefPtrVector<Card> cards, Gfx::IntPoint end, F m_animation_delay_timer = Core::Timer::create_single_shot(initial_delay_ms, [&] { m_animation_playing = true; start_timer(10); - }); + }).release_value_but_fixme_should_propagate_errors(); m_animation_delay_timer->start(); } diff --git a/Userland/Games/MasterWord/WordGame.cpp b/Userland/Games/MasterWord/WordGame.cpp index 755f59c144..a7665458a2 100644 --- a/Userland/Games/MasterWord/WordGame.cpp +++ b/Userland/Games/MasterWord/WordGame.cpp @@ -25,7 +25,7 @@ REGISTER_WIDGET(MasterWord, WordGame) namespace MasterWord { WordGame::WordGame() - : m_clear_message_timer(Core::Timer::create_single_shot(5000, [this] { clear_message(); })) + : m_clear_message_timer(Core::Timer::create_single_shot(5000, [this] { clear_message(); }).release_value_but_fixme_should_propagate_errors()) { read_words(); m_num_letters = Config::read_i32("MasterWord"sv, ""sv, "word_length"sv, 5); diff --git a/Userland/Libraries/LibCore/Debounce.h b/Userland/Libraries/LibCore/Debounce.h index ba40a145bf..e575a2a35a 100644 --- a/Userland/Libraries/LibCore/Debounce.h +++ b/Userland/Libraries/LibCore/Debounce.h @@ -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(); }; diff --git a/Userland/Libraries/LibCore/Timer.h b/Userland/Libraries/LibCore/Timer.h index 23a59794db..043fb21f42 100644 --- a/Userland/Libraries/LibCore/Timer.h +++ b/Userland/Libraries/LibCore/Timer.h @@ -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; diff --git a/Userland/Libraries/LibGUI/Application.cpp b/Userland/Libraries/LibGUI/Application.cpp index 9b38932d66..1abb207436 100644 --- a/Userland/Libraries/LibGUI/Application.cpp +++ b/Userland/Libraries/LibGUI/Application.cpp @@ -95,11 +95,11 @@ Application::Application(int argc, char** argv, Core::EventLoop::MakeInspectable m_tooltip_show_timer = Core::Timer::create_single_shot(700, [this] { request_tooltip_show(); - }); + }).release_value_but_fixme_should_propagate_errors(); m_tooltip_hide_timer = Core::Timer::create_single_shot(50, [this] { tooltip_hide_timer_did_fire(); - }); + }).release_value_but_fixme_should_propagate_errors(); } static bool s_in_teardown; diff --git a/Userland/Libraries/LibGUI/TextEditor.cpp b/Userland/Libraries/LibGUI/TextEditor.cpp index 3236d3c5fc..33eb8cfce1 100644 --- a/Userland/Libraries/LibGUI/TextEditor.cpp +++ b/Userland/Libraries/LibGUI/TextEditor.cpp @@ -2265,7 +2265,7 @@ void TextEditor::set_should_autocomplete_automatically(bool value) m_autocomplete_timer = Core::Timer::create_single_shot(m_automatic_autocomplete_delay_ms, [this] { if (m_autocomplete_box && !m_autocomplete_box->is_visible()) try_show_autocomplete(UserRequestedAutocomplete::No); - }); + }).release_value_but_fixme_should_propagate_errors(); return; } diff --git a/Userland/Libraries/LibIPC/Connection.cpp b/Userland/Libraries/LibIPC/Connection.cpp index ab36d6bc98..0bbf29dfad 100644 --- a/Userland/Libraries/LibIPC/Connection.cpp +++ b/Userland/Libraries/LibIPC/Connection.cpp @@ -27,7 +27,7 @@ ConnectionBase::ConnectionBase(IPC::Stub& local_stub, NonnullOwnPtr<Core::Stream , m_local_endpoint_magic(local_endpoint_magic) , m_deferred_invoker(make<CoreEventLoopDeferredInvoker>()) { - m_responsiveness_timer = Core::Timer::create_single_shot(3000, [this] { may_have_become_unresponsive(); }); + m_responsiveness_timer = Core::Timer::create_single_shot(3000, [this] { may_have_become_unresponsive(); }).release_value_but_fixme_should_propagate_errors(); } void ConnectionBase::set_deferred_invoker(NonnullOwnPtr<DeferredInvoker> deferred_invoker) diff --git a/Userland/Libraries/LibTLS/Socket.cpp b/Userland/Libraries/LibTLS/Socket.cpp index 1cffd09f04..a5ce52f865 100644 --- a/Userland/Libraries/LibTLS/Socket.cpp +++ b/Userland/Libraries/LibTLS/Socket.cpp @@ -144,7 +144,7 @@ void TLSv12::setup_connection() // Extend the timer, we are too slow. m_handshake_timeout_timer->restart(m_max_wait_time_for_handshake_in_seconds * 1000); } - }); + }).release_value_but_fixme_should_propagate_errors(); auto packet = build_hello(); write_packet(packet); write_into_socket(); diff --git a/Userland/Services/AudioServer/Mixer.cpp b/Userland/Services/AudioServer/Mixer.cpp index 5cfbd64890..a865e5012d 100644 --- a/Userland/Services/AudioServer/Mixer.cpp +++ b/Userland/Services/AudioServer/Mixer.cpp @@ -177,7 +177,8 @@ void Mixer::request_setting_sync() if (auto result = m_config->sync(); result.is_error()) dbgln("Failed to write audio mixer config: {}", result.error()); }, - this); + this) + .release_value_but_fixme_should_propagate_errors(); m_config_write_timer->start(); } } diff --git a/Userland/Services/ConfigServer/ConnectionFromClient.cpp b/Userland/Services/ConfigServer/ConnectionFromClient.cpp index 1e3c77b6f7..3daf7faa15 100644 --- a/Userland/Services/ConfigServer/ConnectionFromClient.cpp +++ b/Userland/Services/ConfigServer/ConnectionFromClient.cpp @@ -76,7 +76,7 @@ static Core::ConfigFile& ensure_domain_config(DeprecatedString const& domain) ConnectionFromClient::ConnectionFromClient(NonnullOwnPtr<Core::Stream::LocalSocket> client_socket, int client_id) : IPC::ConnectionFromClient<ConfigClientEndpoint, ConfigServerEndpoint>(*this, move(client_socket), client_id) - , m_sync_timer(Core::Timer::create_single_shot(s_disk_sync_delay_ms, [this]() { sync_dirty_domains_to_disk(); })) + , m_sync_timer(Core::Timer::create_single_shot(s_disk_sync_delay_ms, [this]() { sync_dirty_domains_to_disk(); }).release_value_but_fixme_should_propagate_errors()) { s_connections.set(client_id, *this); } diff --git a/Userland/Services/DHCPClient/DHCPv4Client.cpp b/Userland/Services/DHCPClient/DHCPv4Client.cpp index 20f3c89f99..bb8c16ed81 100644 --- a/Userland/Services/DHCPClient/DHCPv4Client.cpp +++ b/Userland/Services/DHCPClient/DHCPv4Client.cpp @@ -261,7 +261,8 @@ void DHCPv4Client::handle_ack(DHCPv4Packet const& packet, ParsedDHCPv4Options co transaction->has_ip = false; dhcp_discover(interface); }, - this); + this) + .release_value_but_fixme_should_propagate_errors(); Optional<IPv4Address> gateway; if (auto routers = options.get_many<IPv4Address>(DHCPOption::Router, 1); !routers.is_empty()) @@ -288,7 +289,8 @@ void DHCPv4Client::handle_nak(DHCPv4Packet const& packet, ParsedDHCPv4Options co [this, iface = InterfaceDescriptor { iface }] { dhcp_discover(iface); }, - this); + this) + .release_value_but_fixme_should_propagate_errors(); } void DHCPv4Client::process_incoming(DHCPv4Packet const& packet) diff --git a/Userland/Services/RequestServer/ConnectionCache.h b/Userland/Services/RequestServer/ConnectionCache.h index df88591d31..8cdb0b3f18 100644 --- a/Userland/Services/RequestServer/ConnectionCache.h +++ b/Userland/Services/RequestServer/ConnectionCache.h @@ -203,7 +203,7 @@ decltype(auto) get_or_create_connection(auto& cache, URL const& url, auto& job, sockets_for_url.append(make<ConnectionType>( socket_result.release_value(), typename ConnectionType::QueueType {}, - Core::Timer::create_single_shot(ConnectionKeepAliveTimeMilliseconds, nullptr))); + Core::Timer::create_single_shot(ConnectionKeepAliveTimeMilliseconds, nullptr).release_value_but_fixme_should_propagate_errors())); sockets_for_url.last().proxy = move(proxy); did_add_new_connection = true; } diff --git a/Userland/Services/WindowServer/Compositor.cpp b/Userland/Services/WindowServer/Compositor.cpp index 7f32f02c62..cbc49093f2 100644 --- a/Userland/Services/WindowServer/Compositor.cpp +++ b/Userland/Services/WindowServer/Compositor.cpp @@ -55,14 +55,16 @@ Compositor::Compositor() [this] { compose(); }, - this); + this) + .release_value_but_fixme_should_propagate_errors(); m_immediate_compose_timer = Core::Timer::create_single_shot( 0, [this] { compose(); }, - this); + this) + .release_value_but_fixme_should_propagate_errors(); init_bitmaps(); } @@ -1589,7 +1591,8 @@ void Compositor::start_window_stack_switch_overlay_timer() [this] { remove_window_stack_switch_overlays(); }, - this); + this) + .release_value_but_fixme_should_propagate_errors(); m_stack_switch_overlay_timer->start(); } diff --git a/Userland/Services/WindowServer/ConnectionFromClient.cpp b/Userland/Services/WindowServer/ConnectionFromClient.cpp index b1207eb4e6..213090ceb0 100644 --- a/Userland/Services/WindowServer/ConnectionFromClient.cpp +++ b/Userland/Services/WindowServer/ConnectionFromClient.cpp @@ -240,7 +240,7 @@ void ConnectionFromClient::flash_menubar_menu(i32 window_id, i32 menu_id) return; weak_window->menubar().flash_menu(nullptr); weak_window->frame().invalidate_menubar(); - }); + }).release_value_but_fixme_should_propagate_errors(); m_flashed_menu_timer->start(); } else if (m_flashed_menu_timer) { m_flashed_menu_timer->restart(); @@ -1134,7 +1134,7 @@ void ConnectionFromClient::may_have_become_unresponsive() async_ping(); m_ping_timer = Core::Timer::create_single_shot(1000, [this] { set_unresponsive(true); - }); + }).release_value_but_fixme_should_propagate_errors(); m_ping_timer->start(); } diff --git a/Userland/Shell/Shell.cpp b/Userland/Shell/Shell.cpp index 4476bc7f56..3e236db3d2 100644 --- a/Userland/Shell/Shell.cpp +++ b/Userland/Shell/Shell.cpp @@ -1857,9 +1857,9 @@ ErrorOr<Vector<Line::CompletionSuggestion>> Shell::complete_via_program_itself(s true); Vector<Line::CompletionSuggestion> suggestions; - auto timer = Core::Timer::create_single_shot(300, [&] { + auto timer = TRY(Core::Timer::create_single_shot(300, [&] { Core::EventLoop::current().quit(1); - }); + })); timer->start(); // Restrict the process to effectively readonly access to the FS. diff --git a/Userland/Utilities/headless-browser.cpp b/Userland/Utilities/headless-browser.cpp index f0e8834d0a..bc5705aeb9 100644 --- a/Userland/Utilities/headless-browser.cpp +++ b/Userland/Utilities/headless-browser.cpp @@ -700,7 +700,7 @@ static void load_page_for_screenshot_and_exit(HeadlessBrowserPageClient& page_cl MUST(output_file->write(image_buffer.bytes())); exit(0); - }); + }).release_value_but_fixme_should_propagate_errors(); timer->start(); } |