From 73552c18568b8f7e08cd8c474689f922d9bfe659 Mon Sep 17 00:00:00 2001 From: Sam Atkins Date: Sat, 16 Apr 2022 17:17:39 +0100 Subject: [PATCH] Userland: Always construct Application with try_create() --- Userland/Applets/ClipboardHistory/main.cpp | 2 +- Userland/Applets/ResourceGraph/main.cpp | 2 +- Userland/Applications/3DFileViewer/main.cpp | 2 +- Userland/Applications/Assistant/main.cpp | 2 +- Userland/Applications/Browser/main.cpp | 2 +- Userland/Applications/KeyboardMapper/main.cpp | 2 +- Userland/Applications/Magnifier/main.cpp | 2 +- Userland/Applications/Mail/main.cpp | 2 +- Userland/Applications/Piano/main.cpp | 2 +- Userland/Applications/PixelPaint/main.cpp | 2 +- Userland/Applications/SpaceAnalyzer/main.cpp | 2 +- Userland/Applications/Spreadsheet/main.cpp | 2 +- Userland/Applications/ThemeEditor/main.cpp | 2 +- Userland/DevTools/HackStudio/main.cpp | 2 +- Userland/Services/FileSystemAccessServer/main.cpp | 2 +- Userland/Services/LoginServer/main.cpp | 2 +- Userland/Utilities/chres.cpp | 2 +- Userland/Utilities/copy.cpp | 2 +- Userland/Utilities/pape.cpp | 2 +- Userland/Utilities/paste.cpp | 2 +- Userland/Utilities/shot.cpp | 2 +- Userland/Utilities/wsctl.cpp | 2 +- 22 files changed, 22 insertions(+), 22 deletions(-) diff --git a/Userland/Applets/ClipboardHistory/main.cpp b/Userland/Applets/ClipboardHistory/main.cpp index 7205401108..f3e705ae35 100644 --- a/Userland/Applets/ClipboardHistory/main.cpp +++ b/Userland/Applets/ClipboardHistory/main.cpp @@ -18,7 +18,7 @@ ErrorOr serenity_main(Main::Arguments arguments) { TRY(Core::System::pledge("stdio recvfd sendfd rpath unix")); - auto app = GUI::Application::construct(arguments); + auto app = TRY(GUI::Application::try_create(arguments)); Config::pledge_domain("ClipboardHistory"); Config::monitor_domain("ClipboardHistory"); diff --git a/Userland/Applets/ResourceGraph/main.cpp b/Userland/Applets/ResourceGraph/main.cpp index 6b897b6df8..e63a162cbc 100644 --- a/Userland/Applets/ResourceGraph/main.cpp +++ b/Userland/Applets/ResourceGraph/main.cpp @@ -269,7 +269,7 @@ ErrorOr serenity_main(Main::Arguments arguments) { TRY(Core::System::pledge("stdio recvfd sendfd proc exec rpath unix")); - auto app = GUI::Application::construct(arguments); + auto app = TRY(GUI::Application::try_create(arguments)); TRY(Core::System::pledge("stdio recvfd sendfd proc exec rpath")); diff --git a/Userland/Applications/3DFileViewer/main.cpp b/Userland/Applications/3DFileViewer/main.cpp index e27246411b..f4a2475c1e 100644 --- a/Userland/Applications/3DFileViewer/main.cpp +++ b/Userland/Applications/3DFileViewer/main.cpp @@ -356,7 +356,7 @@ bool GLContextWidget::load_file(Core::File& file) ErrorOr serenity_main(Main::Arguments arguments) { - auto app = GUI::Application::construct(arguments); + auto app = TRY(GUI::Application::try_create(arguments)); TRY(Core::System::pledge("stdio thread recvfd sendfd rpath unix prot_exec")); diff --git a/Userland/Applications/Assistant/main.cpp b/Userland/Applications/Assistant/main.cpp index 0b3c149287..d05a2d2efd 100644 --- a/Userland/Applications/Assistant/main.cpp +++ b/Userland/Applications/Assistant/main.cpp @@ -207,7 +207,7 @@ ErrorOr serenity_main(Main::Arguments arguments) return 0; } - auto app = GUI::Application::construct(arguments); + auto app = TRY(GUI::Application::try_create(arguments)); auto window = GUI::Window::construct(); window->set_minimizable(false); diff --git a/Userland/Applications/Browser/main.cpp b/Userland/Applications/Browser/main.cpp index 4c6839c8c2..3d4665c209 100644 --- a/Userland/Applications/Browser/main.cpp +++ b/Userland/Applications/Browser/main.cpp @@ -66,7 +66,7 @@ ErrorOr serenity_main(Main::Arguments arguments) args_parser.add_positional_argument(specified_url, "URL to open", "url", Core::ArgsParser::Required::No); args_parser.parse(arguments); - auto app = GUI::Application::construct(arguments); + auto app = TRY(GUI::Application::try_create(arguments)); Config::pledge_domain("Browser"); Config::monitor_domain("Browser"); diff --git a/Userland/Applications/KeyboardMapper/main.cpp b/Userland/Applications/KeyboardMapper/main.cpp index e532fb9d0c..c421aec6c0 100644 --- a/Userland/Applications/KeyboardMapper/main.cpp +++ b/Userland/Applications/KeyboardMapper/main.cpp @@ -25,7 +25,7 @@ ErrorOr serenity_main(Main::Arguments arguments) TRY(Core::System::pledge("stdio getkeymap thread rpath cpath wpath recvfd sendfd unix")); - auto app = GUI::Application::construct(arguments.argc, arguments.argv); + auto app = TRY(GUI::Application::try_create(arguments)); TRY(Core::System::pledge("stdio getkeymap thread rpath cpath wpath recvfd sendfd")); diff --git a/Userland/Applications/Magnifier/main.cpp b/Userland/Applications/Magnifier/main.cpp index 8cc721886a..ad93313ad1 100644 --- a/Userland/Applications/Magnifier/main.cpp +++ b/Userland/Applications/Magnifier/main.cpp @@ -18,7 +18,7 @@ ErrorOr serenity_main(Main::Arguments arguments) { TRY(Core::System::pledge("stdio cpath rpath recvfd sendfd unix")); - auto app = GUI::Application::construct(arguments); + auto app = TRY(GUI::Application::try_create(arguments)); TRY(Core::System::pledge("stdio cpath rpath recvfd sendfd")); TRY(Core::System::unveil("/res", "r")); diff --git a/Userland/Applications/Mail/main.cpp b/Userland/Applications/Mail/main.cpp index a0a4384a4e..4e8c5e3895 100644 --- a/Userland/Applications/Mail/main.cpp +++ b/Userland/Applications/Mail/main.cpp @@ -20,7 +20,7 @@ ErrorOr serenity_main(Main::Arguments arguments) { TRY(Core::System::pledge("stdio recvfd sendfd rpath unix inet")); - auto app = GUI::Application::construct(arguments); + auto app = TRY(GUI::Application::try_create(arguments)); Config::pledge_domain("Mail"); diff --git a/Userland/Applications/Piano/main.cpp b/Userland/Applications/Piano/main.cpp index 5093de32b9..6f57947223 100644 --- a/Userland/Applications/Piano/main.cpp +++ b/Userland/Applications/Piano/main.cpp @@ -29,7 +29,7 @@ ErrorOr serenity_main(Main::Arguments arguments) { TRY(Core::System::pledge("stdio thread rpath cpath wpath recvfd sendfd unix")); - auto app = GUI::Application::construct(arguments); + auto app = TRY(GUI::Application::try_create(arguments)); TrackManager track_manager; diff --git a/Userland/Applications/PixelPaint/main.cpp b/Userland/Applications/PixelPaint/main.cpp index 71ba88cf13..47cf207c3f 100644 --- a/Userland/Applications/PixelPaint/main.cpp +++ b/Userland/Applications/PixelPaint/main.cpp @@ -23,7 +23,7 @@ ErrorOr serenity_main(Main::Arguments arguments) { TRY(Core::System::pledge("stdio thread recvfd sendfd rpath unix wpath cpath")); - auto app = GUI::Application::construct(arguments); + auto app = TRY(GUI::Application::try_create(arguments)); Config::pledge_domain("PixelPaint"); char const* image_file = nullptr; diff --git a/Userland/Applications/SpaceAnalyzer/main.cpp b/Userland/Applications/SpaceAnalyzer/main.cpp index 560c7d9e4e..04864c2265 100644 --- a/Userland/Applications/SpaceAnalyzer/main.cpp +++ b/Userland/Applications/SpaceAnalyzer/main.cpp @@ -302,7 +302,7 @@ static String get_absolute_path_to_selected_node(SpaceAnalyzer::TreeMapWidget co ErrorOr serenity_main(Main::Arguments arguments) { - auto app = GUI::Application::construct(arguments); + auto app = TRY(GUI::Application::try_create(arguments)); RefPtr tree = adopt_ref(*new Tree("")); diff --git a/Userland/Applications/Spreadsheet/main.cpp b/Userland/Applications/Spreadsheet/main.cpp index 657f6b25e3..25e03aad3d 100644 --- a/Userland/Applications/Spreadsheet/main.cpp +++ b/Userland/Applications/Spreadsheet/main.cpp @@ -28,7 +28,7 @@ ErrorOr serenity_main(Main::Arguments arguments) { TRY(Core::System::pledge("stdio recvfd sendfd rpath fattr unix cpath wpath thread")); - auto app = GUI::Application::construct(arguments); + auto app = TRY(GUI::Application::try_create(arguments)); char const* filename = nullptr; diff --git a/Userland/Applications/ThemeEditor/main.cpp b/Userland/Applications/ThemeEditor/main.cpp index 9149e5285b..7e068bfe6c 100644 --- a/Userland/Applications/ThemeEditor/main.cpp +++ b/Userland/Applications/ThemeEditor/main.cpp @@ -161,7 +161,7 @@ ErrorOr serenity_main(Main::Arguments arguments) { TRY(Core::System::pledge("stdio recvfd sendfd thread rpath cpath wpath unix")); - auto app = GUI::Application::construct(arguments); + auto app = TRY(GUI::Application::try_create(arguments)); char const* file_to_edit = nullptr; diff --git a/Userland/DevTools/HackStudio/main.cpp b/Userland/DevTools/HackStudio/main.cpp index 9473fcdc4d..94fb9d2880 100644 --- a/Userland/DevTools/HackStudio/main.cpp +++ b/Userland/DevTools/HackStudio/main.cpp @@ -38,7 +38,7 @@ ErrorOr serenity_main(Main::Arguments arguments) { TRY(Core::System::pledge("stdio recvfd sendfd tty rpath cpath wpath proc exec unix fattr thread ptrace")); - auto app = GUI::Application::construct(arguments.argc, arguments.argv); + auto app = TRY(GUI::Application::try_create(arguments)); Config::pledge_domains({ "HackStudio", "Terminal" }); auto window = GUI::Window::construct(); diff --git a/Userland/Services/FileSystemAccessServer/main.cpp b/Userland/Services/FileSystemAccessServer/main.cpp index 8a1476d688..5556104df2 100644 --- a/Userland/Services/FileSystemAccessServer/main.cpp +++ b/Userland/Services/FileSystemAccessServer/main.cpp @@ -14,7 +14,7 @@ ErrorOr serenity_main(Main::Arguments) { TRY(Core::System::pledge("stdio recvfd sendfd rpath cpath wpath unix thread")); - auto app = GUI::Application::construct(0, nullptr); + auto app = TRY(GUI::Application::try_create(0, nullptr)); app->set_quit_when_last_window_deleted(false); auto client = TRY(IPC::take_over_accepted_client_from_system_server()); diff --git a/Userland/Services/LoginServer/main.cpp b/Userland/Services/LoginServer/main.cpp index 8c49eaa813..77fc8fbad4 100644 --- a/Userland/Services/LoginServer/main.cpp +++ b/Userland/Services/LoginServer/main.cpp @@ -54,7 +54,7 @@ static void login(Core::Account const& account, LoginWindow& window) ErrorOr serenity_main(Main::Arguments arguments) { - auto app = GUI::Application::construct(arguments); + auto app = TRY(GUI::Application::try_create(arguments)); TRY(Core::System::pledge("stdio recvfd sendfd rpath exec proc id")); TRY(Core::System::unveil("/home", "r")); diff --git a/Userland/Utilities/chres.cpp b/Userland/Utilities/chres.cpp index 3f27e0b029..4bfc5f48b6 100644 --- a/Userland/Utilities/chres.cpp +++ b/Userland/Utilities/chres.cpp @@ -26,7 +26,7 @@ ErrorOr serenity_main(Main::Arguments arguments) // A Core::EventLoop is all we need, but ConnectionToWindowServer needs a full Application object. char* dummy_argv[] = { arguments.argv[0] }; - auto app = GUI::Application::construct(1, dummy_argv); + auto app = TRY(GUI::Application::try_create(1, dummy_argv)); auto screen_layout = GUI::ConnectionToWindowServer::the().get_screen_layout(); if (screen < 0 || (size_t)screen >= screen_layout.screens.size()) { warnln("invalid screen index: {}", screen); diff --git a/Userland/Utilities/copy.cpp b/Userland/Utilities/copy.cpp index 04562db98e..cb4a222929 100644 --- a/Userland/Utilities/copy.cpp +++ b/Userland/Utilities/copy.cpp @@ -64,7 +64,7 @@ static Options parse_options(Main::Arguments arguments) ErrorOr serenity_main(Main::Arguments arguments) { - auto app = GUI::Application::construct(arguments); + auto app = TRY(GUI::Application::try_create(arguments)); Options options = parse_options(arguments); diff --git a/Userland/Utilities/pape.cpp b/Userland/Utilities/pape.cpp index bbeb27b147..f3f28a2e88 100644 --- a/Userland/Utilities/pape.cpp +++ b/Userland/Utilities/pape.cpp @@ -28,7 +28,7 @@ ErrorOr serenity_main(Main::Arguments arguments) args_parser.add_positional_argument(path, "Wallpaper to set", "path", Core::ArgsParser::Required::No); args_parser.parse(arguments); - auto app = GUI::Application::construct(arguments); + auto app = TRY(GUI::Application::try_create(arguments)); if (show_all) { Core::DirIterator wallpapers_directory_iterator("/res/wallpapers", Core::DirIterator::SkipDots); diff --git a/Userland/Utilities/paste.cpp b/Userland/Utilities/paste.cpp index 4083ef0207..20e9db0b2d 100644 --- a/Userland/Utilities/paste.cpp +++ b/Userland/Utilities/paste.cpp @@ -62,7 +62,7 @@ ErrorOr serenity_main(Main::Arguments arguments) args_parser.add_positional_argument(watch_command, "Command to run in watch mode", "command", Core::ArgsParser::Required::No); args_parser.parse(arguments); - auto app = GUI::Application::construct(arguments); + auto app = TRY(GUI::Application::try_create(arguments)); auto& clipboard = GUI::Clipboard::the(); diff --git a/Userland/Utilities/shot.cpp b/Userland/Utilities/shot.cpp index 7c7223c4d2..399954fe0c 100644 --- a/Userland/Utilities/shot.cpp +++ b/Userland/Utilities/shot.cpp @@ -109,7 +109,7 @@ ErrorOr serenity_main(Main::Arguments arguments) output_path = Core::DateTime::now().to_string("screenshot-%Y-%m-%d-%H-%M-%S.png"); } - auto app = GUI::Application::construct(arguments.argc, arguments.argv); + auto app = TRY(GUI::Application::try_create(arguments)); Optional crop_region; if (select_region) { auto window = GUI::Window::construct(); diff --git a/Userland/Utilities/wsctl.cpp b/Userland/Utilities/wsctl.cpp index 29c8b7480e..71cdc5bb72 100644 --- a/Userland/Utilities/wsctl.cpp +++ b/Userland/Utilities/wsctl.cpp @@ -10,7 +10,7 @@ ErrorOr serenity_main(Main::Arguments arguments) { - auto app = GUI::Application::construct(arguments); + auto app = TRY(GUI::Application::try_create(arguments)); int flash_flush = -1; Core::ArgsParser args_parser;