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

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

View file

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

View file

@ -356,7 +356,7 @@ bool GLContextWidget::load_file(Core::File& file)
ErrorOr<int> 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"));

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -302,7 +302,7 @@ static String get_absolute_path_to_selected_node(SpaceAnalyzer::TreeMapWidget co
ErrorOr<int> serenity_main(Main::Arguments arguments)
{
auto app = GUI::Application::construct(arguments);
auto app = TRY(GUI::Application::try_create(arguments));
RefPtr<Tree> tree = adopt_ref(*new Tree(""));

View file

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

View file

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

View file

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

View file

@ -14,7 +14,7 @@ ErrorOr<int> 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<FileSystemAccessServer::ConnectionFromClient>());

View file

@ -54,7 +54,7 @@ static void login(Core::Account const& account, LoginWindow& window)
ErrorOr<int> 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"));

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;