1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-24 22:27:42 +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

@ -55,7 +55,7 @@ int main(int argc, char** argv)
return 1;
}
GUI::Application app(argc, argv);
auto app = GUI::Application::construct(argc, argv);
if (pledge("stdio shared_buffer accept cpath rpath wpath proc exec thread", nullptr) < 0) {
perror("pledge");
@ -166,7 +166,7 @@ int main(int argc, char** argv)
auto quit_action = GUI::CommonActions::make_quit_action(
[&](auto&) {
app.quit();
app->quit();
});
auto rotate_left_action = GUI::Action::create("Rotate Left", { Mod_None, Key_L },
@ -290,7 +290,7 @@ int main(int argc, char** argv)
auto& help_menu = menubar->add_menu("Help");
help_menu.add_action(about_action);
app.set_menubar(move(menubar));
app->set_menubar(move(menubar));
if (path != nullptr) {
widget.load_from_file(path);
@ -298,5 +298,5 @@ int main(int argc, char** argv)
window->show();
return app.exec();
return app->exec();
}