1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 12:47:45 +00:00

Run: Fix bug where it would crash because uninitialized main widget

The set_main_widget<T>() function only calls the construct and not
`try_create()` that the GMLCompiler generates so all calls to
`find_descendant_of_type_named()` would result in null
pointers that would resolve in a crash.
This commit is contained in:
Bastiaan van der Plaat 2024-01-30 21:54:20 +01:00 committed by Andreas Kling
parent 747fd86f26
commit 582bf1eaf3
3 changed files with 12 additions and 3 deletions

View file

@ -15,7 +15,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
TRY(Core::System::pledge("stdio recvfd sendfd thread cpath rpath wpath unix proc exec"));
auto app = TRY(GUI::Application::create(arguments));
auto window = TRY(RunWindow::try_create());
auto window = TRY(Run::RunWindow::try_create());
constexpr int margin = 16;
window->move_to(margin, GUI::Desktop::the().rect().bottom() - 1 - GUI::Desktop::the().taskbar_height() - margin - window->height());