1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 06:07:34 +00:00

LibGUI: Make GUI::Application a Core::Object

Having this on the stack makes whole-program teardown iffy. Turning it
into a Core::Object allows anyone who needs it to extends its lifetime.
This commit is contained in:
Andreas Kling 2020-07-04 14:05:19 +02:00
parent 0d577ab781
commit 1dd1595043
51 changed files with 140 additions and 138 deletions

View file

@ -209,7 +209,7 @@ int main(int argc, char** argv)
return 1;
}
GUI::Application app(argc, argv);
auto app = GUI::Application::construct(argc, argv);
if (pledge("stdio tty rpath accept cpath wpath shared_buffer proc exec unix", nullptr) < 0) {
perror("pledge");
@ -251,7 +251,7 @@ int main(int argc, char** argv)
auto& terminal = window->set_main_widget<TerminalWidget>(ptm_fd, true, config);
terminal.on_command_exit = [&] {
app.quit(0);
app->quit(0);
};
terminal.on_title_change = [&](auto& title) {
window->set_title(title);
@ -321,7 +321,7 @@ int main(int argc, char** argv)
GUI::AboutDialog::show("Terminal", Gfx::Bitmap::load_from_file("/res/icons/32x32/app-terminal.png"), window);
}));
app.set_menubar(move(menubar));
app->set_menubar(move(menubar));
if (unveil("/res", "r") < 0) {
perror("unveil");
@ -346,5 +346,5 @@ int main(int argc, char** argv)
unveil(nullptr, nullptr);
config->sync();
return app.exec();
return app->exec();
}