1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-28 09:17:45 +00:00

Userland: Always construct Application with try_create()

This commit is contained in:
Sam Atkins 2022-04-16 17:17:39 +01:00 committed by Andreas Kling
parent cd7037afd5
commit 73552c1856
22 changed files with 22 additions and 22 deletions

View file

@ -26,7 +26,7 @@ ErrorOr<int> 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);

View file

@ -64,7 +64,7 @@ static Options parse_options(Main::Arguments arguments)
ErrorOr<int> serenity_main(Main::Arguments arguments)
{
auto app = GUI::Application::construct(arguments);
auto app = TRY(GUI::Application::try_create(arguments));
Options options = parse_options(arguments);

View file

@ -28,7 +28,7 @@ ErrorOr<int> 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);

View file

@ -62,7 +62,7 @@ ErrorOr<int> 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();

View file

@ -109,7 +109,7 @@ ErrorOr<int> 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<Gfx::IntRect> crop_region;
if (select_region) {
auto window = GUI::Window::construct();

View file

@ -10,7 +10,7 @@
ErrorOr<int> 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;