mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-09-11 13:36:13 +03:00
Userland: Always construct Application with try_create()
This commit is contained in:
parent
cd7037afd5
commit
73552c1856
Notes:
sideshowbarker
2024-07-17 14:36:19 +09:00
Author: https://github.com/AtkinsSJ Commit: https://github.com/SerenityOS/serenity/commit/73552c1856 Pull-request: https://github.com/SerenityOS/serenity/pull/13707 Reviewed-by: https://github.com/alimpfard
@ -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");
|
||||
|
@ -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"));
|
||||
|
||||
|
@ -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"));
|
||||
|
||||
|
@ -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);
|
||||
|
||||
|
@ -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");
|
||||
|
@ -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"));
|
||||
|
||||
|
@ -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"));
|
||||
|
@ -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");
|
||||
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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;
|
||||
|
@ -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(""));
|
||||
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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();
|
||||
|
@ -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>());
|
||||
|
@ -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"));
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
||||
|
@ -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);
|
||||
|
@ -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();
|
||||
|
||||
|
@ -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();
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user