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/Applets | |
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/Applets')
-rw-r--r-- | Userland/Applets/Audio/main.cpp | 2 | ||||
-rw-r--r-- | Userland/Applets/ClipboardHistory/main.cpp | 2 | ||||
-rw-r--r-- | Userland/Applets/Keymap/main.cpp | 2 | ||||
-rw-r--r-- | Userland/Applets/Network/main.cpp | 2 | ||||
-rw-r--r-- | Userland/Applets/ResourceGraph/main.cpp | 2 | ||||
-rw-r--r-- | Userland/Applets/WorkspacePicker/main.cpp | 2 |
6 files changed, 6 insertions, 6 deletions
diff --git a/Userland/Applets/Audio/main.cpp b/Userland/Applets/Audio/main.cpp index 229b22ebd7..8bce27ab30 100644 --- a/Userland/Applets/Audio/main.cpp +++ b/Userland/Applets/Audio/main.cpp @@ -231,7 +231,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments) { TRY(Core::System::pledge("stdio recvfd sendfd rpath wpath cpath unix thread")); - auto app = TRY(GUI::Application::try_create(arguments)); + auto app = TRY(GUI::Application::create(arguments)); Config::pledge_domain("AudioApplet"); TRY(Core::System::unveil("/tmp/session/%sid/portal/audio", "rw")); TRY(Core::System::unveil("/res", "r")); diff --git a/Userland/Applets/ClipboardHistory/main.cpp b/Userland/Applets/ClipboardHistory/main.cpp index bea6d1f8e6..95a16d105b 100644 --- a/Userland/Applets/ClipboardHistory/main.cpp +++ b/Userland/Applets/ClipboardHistory/main.cpp @@ -18,7 +18,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments) { TRY(Core::System::pledge("stdio recvfd sendfd rpath unix")); - auto app = TRY(GUI::Application::try_create(arguments)); + auto app = TRY(GUI::Application::create(arguments)); Config::pledge_domain("ClipboardHistory"); Config::monitor_domain("ClipboardHistory"); diff --git a/Userland/Applets/Keymap/main.cpp b/Userland/Applets/Keymap/main.cpp index 616e76f1ef..2fd0c7d826 100644 --- a/Userland/Applets/Keymap/main.cpp +++ b/Userland/Applets/Keymap/main.cpp @@ -15,7 +15,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments) { TRY(Core::System::pledge("stdio recvfd sendfd rpath unix getkeymap proc exec")); - auto app = TRY(GUI::Application::try_create(arguments)); + auto app = TRY(GUI::Application::create(arguments)); auto window = TRY(KeymapStatusWindow::try_create()); window->set_has_alpha_channel(true); diff --git a/Userland/Applets/Network/main.cpp b/Userland/Applets/Network/main.cpp index b361d983e9..e073fcc038 100644 --- a/Userland/Applets/Network/main.cpp +++ b/Userland/Applets/Network/main.cpp @@ -164,7 +164,7 @@ private: ErrorOr<int> serenity_main(Main::Arguments arguments) { TRY(Core::System::pledge("stdio recvfd sendfd rpath unix proc exec")); - auto app = TRY(GUI::Application::try_create(arguments)); + auto app = TRY(GUI::Application::create(arguments)); TRY(Core::System::unveil("/tmp/session/%sid/portal/notify", "rw")); TRY(Core::System::unveil("/res", "r")); diff --git a/Userland/Applets/ResourceGraph/main.cpp b/Userland/Applets/ResourceGraph/main.cpp index 836a1e7d39..7008d995b1 100644 --- a/Userland/Applets/ResourceGraph/main.cpp +++ b/Userland/Applets/ResourceGraph/main.cpp @@ -239,7 +239,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments) { TRY(Core::System::pledge("stdio recvfd sendfd proc exec rpath unix")); - auto app = TRY(GUI::Application::try_create(arguments)); + auto app = TRY(GUI::Application::create(arguments)); TRY(Core::System::pledge("stdio recvfd sendfd proc exec rpath")); diff --git a/Userland/Applets/WorkspacePicker/main.cpp b/Userland/Applets/WorkspacePicker/main.cpp index 028189ba5f..b9ec4bc442 100644 --- a/Userland/Applets/WorkspacePicker/main.cpp +++ b/Userland/Applets/WorkspacePicker/main.cpp @@ -17,7 +17,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments) { TRY(Core::System::pledge("stdio recvfd sendfd rpath proc exec unix")); - auto app = TRY(GUI::Application::try_create(arguments)); + auto app = TRY(GUI::Application::create(arguments)); app->set_quit_when_last_window_deleted(false); // We need to obtain the WM connection here as well before the pledge shortening. |