From 1a97382305f517dcc4c4f71746b6ab5d96012b0d Mon Sep 17 00:00:00 2001 From: Lucas CHOLLET Date: Fri, 5 May 2023 00:24:53 -0400 Subject: 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. --- Userland/Demos/LibGfxScaleDemo/main.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Userland/Demos/LibGfxScaleDemo') 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 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")); -- cgit v1.2.3