summaryrefslogtreecommitdiff
path: root/Games
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2020-07-04 16:52:01 +0200
committerAndreas Kling <kling@serenityos.org>2020-07-04 16:54:55 +0200
commitca93c22ae2706c35828f913976f35e828157bb01 (patch)
tree6daa1e52973d55636634ceb69fc0fe15b6bd50f4 /Games
parentf7577585a6794228659e5e7b496cddfd8a94b54d (diff)
downloadserenity-ca93c22ae2706c35828f913976f35e828157bb01.zip
LibGUI: Turn GUI::Application::the() into a pointer
During app teardown, the Application object may be destroyed before something else, and so having Application::the() return a reference was obscuring the truth about its lifetime. This patch makes the API more honest by returning a pointer. While this makes call sites look a bit more sketchy, do note that the global Application pointer only becomes null during app teardown.
Diffstat (limited to 'Games')
-rw-r--r--Games/Minesweeper/main.cpp2
-rw-r--r--Games/Snake/main.cpp2
2 files changed, 2 insertions, 2 deletions
diff --git a/Games/Minesweeper/main.cpp b/Games/Minesweeper/main.cpp
index 4f7ce5468f..8556815d89 100644
--- a/Games/Minesweeper/main.cpp
+++ b/Games/Minesweeper/main.cpp
@@ -104,7 +104,7 @@ int main(int argc, char** argv)
app_menu.add_separator();
app_menu.add_action(GUI::CommonActions::make_quit_action([](auto&) {
- GUI::Application::the().quit(0);
+ GUI::Application::the()->quit();
return;
}));
diff --git a/Games/Snake/main.cpp b/Games/Snake/main.cpp
index ad24a3449e..6abc482e66 100644
--- a/Games/Snake/main.cpp
+++ b/Games/Snake/main.cpp
@@ -65,7 +65,7 @@ int main(int argc, char** argv)
game.reset();
}));
app_menu.add_action(GUI::CommonActions::make_quit_action([](auto&) {
- GUI::Application::the().quit(0);
+ GUI::Application::the()->quit();
}));
auto& help_menu = menubar->add_menu("Help");