diff options
author | Lucas CHOLLET <lucas.chollet@free.fr> | 2023-05-05 00:24:53 -0400 |
---|---|---|
committer | Sam Atkins <atkinssj@gmail.com> | 2023-05-05 16:41:21 +0100 |
commit | 1a97382305f517dcc4c4f71746b6ab5d96012b0d (patch) | |
tree | 71bc8573bea401d8a27847c1dadeeceb518fd1a0 /Userland/Demos | |
parent | f132751faeaa486c3eebc1ed23117efe9701da22 (diff) | |
download | serenity-1a97382305f517dcc4c4f71746b6ab5d96012b0d.zip |
LibGUI: Make `Application`'s construction fallible
The pattern to construct `Application` was to use the `try_create`
method from the `C_OBJECT` macro. While being safe from an OOM
perspective, this method doesn't propagate errors from the constructor.
This patch make `Application` use the `C_OBJECT_ABSTRACT` and manually
define a `create` method that can bubble up errors from the
construction stage.
This commit also removes the ability to use `argc` and `argv` to
create an `Application`, only `Main`'s `Arguments` can be used.
From a user point of view, the patch renames `try_create` => `create`,
hence the huge number of modified files.
Diffstat (limited to 'Userland/Demos')
-rw-r--r-- | Userland/Demos/CatDog/main.cpp | 2 | ||||
-rw-r--r-- | Userland/Demos/Eyes/main.cpp | 2 | ||||
-rw-r--r-- | Userland/Demos/Gradient/Gradient.cpp | 2 | ||||
-rw-r--r-- | Userland/Demos/LibGfxDemo/main.cpp | 2 | ||||
-rw-r--r-- | Userland/Demos/LibGfxScaleDemo/main.cpp | 2 | ||||
-rw-r--r-- | Userland/Demos/Mandelbrot/Mandelbrot.cpp | 2 | ||||
-rw-r--r-- | Userland/Demos/ModelGallery/main.cpp | 2 | ||||
-rw-r--r-- | Userland/Demos/Screensaver/main.cpp | 2 | ||||
-rw-r--r-- | Userland/Demos/Starfield/Starfield.cpp | 2 | ||||
-rw-r--r-- | Userland/Demos/Tubes/main.cpp | 2 | ||||
-rw-r--r-- | Userland/Demos/WidgetGallery/main.cpp | 2 |
11 files changed, 11 insertions, 11 deletions
diff --git a/Userland/Demos/CatDog/main.cpp b/Userland/Demos/CatDog/main.cpp index 76e7796dfd..d657e44696 100644 --- a/Userland/Demos/CatDog/main.cpp +++ b/Userland/Demos/CatDog/main.cpp @@ -21,7 +21,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments) { TRY(Core::System::pledge("stdio recvfd sendfd rpath wpath cpath unix")); - auto app = TRY(GUI::Application::try_create(arguments)); + auto app = TRY(GUI::Application::create(arguments)); auto app_icon = TRY(GUI::Icon::try_create_default_icon("app-catdog"sv)); TRY(Core::System::pledge("stdio recvfd sendfd rpath")); diff --git a/Userland/Demos/Eyes/main.cpp b/Userland/Demos/Eyes/main.cpp index 2fb554ca7a..218c8c308a 100644 --- a/Userland/Demos/Eyes/main.cpp +++ b/Userland/Demos/Eyes/main.cpp @@ -38,7 +38,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments) TRY(Core::System::pledge("stdio recvfd sendfd rpath unix cpath wpath thread")); - auto app = TRY(GUI::Application::try_create(arguments)); + auto app = TRY(GUI::Application::create(arguments)); TRY(Core::System::unveil("/tmp/session/%sid/portal/launch", "rw")); TRY(Core::System::unveil("/res", "r")); diff --git a/Userland/Demos/Gradient/Gradient.cpp b/Userland/Demos/Gradient/Gradient.cpp index 8a36ff927b..04e7374687 100644 --- a/Userland/Demos/Gradient/Gradient.cpp +++ b/Userland/Demos/Gradient/Gradient.cpp @@ -89,7 +89,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments) { TRY(Core::System::pledge("stdio rpath recvfd sendfd unix")); - auto app = TRY(GUI::Application::try_create(arguments)); + auto app = TRY(GUI::Application::create(arguments)); TRY(Core::System::pledge("stdio rpath recvfd sendfd")); TRY(Core::System::unveil("/res", "r")); diff --git a/Userland/Demos/LibGfxDemo/main.cpp b/Userland/Demos/LibGfxDemo/main.cpp index b2c73a3821..3f539cc038 100644 --- a/Userland/Demos/LibGfxDemo/main.cpp +++ b/Userland/Demos/LibGfxDemo/main.cpp @@ -185,7 +185,7 @@ void Canvas::draw() ErrorOr<int> serenity_main(Main::Arguments arguments) { - auto app = TRY(GUI::Application::try_create(arguments)); + auto app = TRY(GUI::Application::create(arguments)); TRY(Core::System::pledge("stdio recvfd sendfd rpath")); TRY(Core::System::unveil("/res", "r")); diff --git a/Userland/Demos/LibGfxScaleDemo/main.cpp b/Userland/Demos/LibGfxScaleDemo/main.cpp index d0222ee4f4..a1709f3bf3 100644 --- a/Userland/Demos/LibGfxScaleDemo/main.cpp +++ b/Userland/Demos/LibGfxScaleDemo/main.cpp @@ -105,7 +105,7 @@ void Canvas::draw(Gfx::Painter& painter) ErrorOr<int> serenity_main(Main::Arguments arguments) { - auto app = TRY(GUI::Application::try_create(arguments)); + auto app = TRY(GUI::Application::create(arguments)); TRY(Core::System::pledge("stdio recvfd sendfd rpath")); TRY(Core::System::unveil("/res", "r")); diff --git a/Userland/Demos/Mandelbrot/Mandelbrot.cpp b/Userland/Demos/Mandelbrot/Mandelbrot.cpp index 197c235579..cf53b0e9e3 100644 --- a/Userland/Demos/Mandelbrot/Mandelbrot.cpp +++ b/Userland/Demos/Mandelbrot/Mandelbrot.cpp @@ -396,7 +396,7 @@ ErrorOr<void> Mandelbrot::export_image(DeprecatedString const& export_path, Imag ErrorOr<int> serenity_main(Main::Arguments arguments) { - auto app = TRY(GUI::Application::try_create(arguments)); + auto app = TRY(GUI::Application::create(arguments)); TRY(Core::System::pledge("stdio thread recvfd sendfd rpath wpath cpath")); diff --git a/Userland/Demos/ModelGallery/main.cpp b/Userland/Demos/ModelGallery/main.cpp index 8c78ab6c2b..0709c1fb17 100644 --- a/Userland/Demos/ModelGallery/main.cpp +++ b/Userland/Demos/ModelGallery/main.cpp @@ -18,7 +18,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments) { TRY(Core::System::pledge("stdio recvfd sendfd rpath wpath cpath unix")); - auto app = TRY(GUI::Application::try_create(arguments)); + auto app = TRY(GUI::Application::create(arguments)); TRY(Core::System::pledge("stdio recvfd sendfd rpath")); diff --git a/Userland/Demos/Screensaver/main.cpp b/Userland/Demos/Screensaver/main.cpp index 372fc35016..403065795b 100644 --- a/Userland/Demos/Screensaver/main.cpp +++ b/Userland/Demos/Screensaver/main.cpp @@ -66,7 +66,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments) { TRY(Core::System::pledge("stdio thread recvfd sendfd rpath cpath wpath unix proc exec")); - auto app = TRY(GUI::Application::try_create(arguments)); + auto app = TRY(GUI::Application::create(arguments)); TRY(Core::System::pledge("stdio thread recvfd sendfd rpath cpath wpath proc exec")); diff --git a/Userland/Demos/Starfield/Starfield.cpp b/Userland/Demos/Starfield/Starfield.cpp index ebf6e6e5e5..8cddd78a46 100644 --- a/Userland/Demos/Starfield/Starfield.cpp +++ b/Userland/Demos/Starfield/Starfield.cpp @@ -161,7 +161,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments) args_parser.add_option(speed, "Speed (default = 1)", "speed", 's', "number"); args_parser.parse(arguments); - auto app = TRY(GUI::Application::try_create(arguments)); + auto app = TRY(GUI::Application::create(arguments)); TRY(Core::System::pledge("stdio recvfd sendfd rpath")); diff --git a/Userland/Demos/Tubes/main.cpp b/Userland/Demos/Tubes/main.cpp index 33ae9ecca2..9f585e205a 100644 --- a/Userland/Demos/Tubes/main.cpp +++ b/Userland/Demos/Tubes/main.cpp @@ -22,7 +22,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments) args_parser.add_option(refresh_rate, "Refresh rate", "rate", 'r', "milliseconds"); args_parser.parse(arguments); - auto app = TRY(GUI::Application::try_create(arguments)); + auto app = TRY(GUI::Application::create(arguments)); TRY(Core::System::pledge("stdio recvfd sendfd rpath prot_exec map_fixed")); diff --git a/Userland/Demos/WidgetGallery/main.cpp b/Userland/Demos/WidgetGallery/main.cpp index a3f1035de6..53b1785c3d 100644 --- a/Userland/Demos/WidgetGallery/main.cpp +++ b/Userland/Demos/WidgetGallery/main.cpp @@ -15,7 +15,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments) { TRY(Core::System::pledge("stdio recvfd sendfd rpath unix thread")); - auto app = TRY(GUI::Application::try_create(arguments)); + auto app = TRY(GUI::Application::create(arguments)); TRY(Core::System::unveil("/tmp/session/%sid/portal/filesystemaccess", "rw")); TRY(Core::System::unveil("/res", "r")); |