summaryrefslogtreecommitdiff
path: root/Applications/KeyboardSettings
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2020-07-04 14:05:19 +0200
committerAndreas Kling <kling@serenityos.org>2020-07-04 14:05:57 +0200
commit1dd15950439f4027f6412bb3748f7f433e60924b (patch)
tree9d80cf082ebb91247bc885a444d58514a4d9a8df /Applications/KeyboardSettings
parent0d577ab7815f6ccdba7d85d94ae8cc80d96ea5ea (diff)
downloadserenity-1dd15950439f4027f6412bb3748f7f433e60924b.zip
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.
Diffstat (limited to 'Applications/KeyboardSettings')
-rw-r--r--Applications/KeyboardSettings/main.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/Applications/KeyboardSettings/main.cpp b/Applications/KeyboardSettings/main.cpp
index 0cb4aaad5a..dae47939cf 100644
--- a/Applications/KeyboardSettings/main.cpp
+++ b/Applications/KeyboardSettings/main.cpp
@@ -50,7 +50,7 @@ int main(int argc, char** argv)
}
// If there is no command line parameter go for GUI.
- GUI::Application app(argc, argv);
+ auto app = GUI::Application::construct(argc, argv);
if (pledge("stdio rpath accept shared_buffer proc exec", nullptr) < 0) {
perror("pledge");
@@ -131,7 +131,7 @@ int main(int argc, char** argv)
exit(1);
}
if (quit)
- app.quit();
+ app->quit();
};
auto& bottom_widget = root_widget.add<GUI::Widget>();
@@ -161,12 +161,12 @@ int main(int argc, char** argv)
cancel_button.set_size_policy(Orientation::Horizontal, GUI::SizePolicy::Fixed);
cancel_button.set_preferred_size(60, 22);
cancel_button.on_click = [&](auto) {
- app.quit();
+ app->quit();
};
auto quit_action = GUI::CommonActions::make_quit_action(
[&](auto&) {
- app.quit();
+ app->quit();
});
auto about_action = GUI::Action::create("About",
@@ -182,9 +182,9 @@ 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));
window->show();
- return app.exec();
+ return app->exec();
}