From ca93c22ae2706c35828f913976f35e828157bb01 Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Sat, 4 Jul 2020 16:52:01 +0200 Subject: 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. --- Applications/FileManager/main.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'Applications/FileManager/main.cpp') diff --git a/Applications/FileManager/main.cpp b/Applications/FileManager/main.cpp index 727d31403b..b227bf51d5 100644 --- a/Applications/FileManager/main.cpp +++ b/Applications/FileManager/main.cpp @@ -225,7 +225,7 @@ int run_in_desktop_mode(RefPtr config, String initial_location }; window->show(); - return GUI::Application::the().exec(); + return GUI::Application::the()->exec(); } int run_in_windowed_mode(RefPtr config, String initial_location) @@ -627,7 +627,7 @@ int run_in_windowed_mode(RefPtr config, String initial_locatio app_menu.add_action(properties_action); app_menu.add_separator(); app_menu.add_action(GUI::CommonActions::make_quit_action([](auto&) { - GUI::Application::the().quit(0); + GUI::Application::the()->quit(); })); auto& view_menu = menubar->add_menu("View"); @@ -646,7 +646,7 @@ int run_in_windowed_mode(RefPtr config, String initial_locatio GUI::AboutDialog::show("File Manager", Gfx::Bitmap::load_from_file("/res/icons/32x32/filetype-folder.png"), window); })); - GUI::Application::the().set_menubar(move(menubar)); + GUI::Application::the()->set_menubar(move(menubar)); main_toolbar.add_action(go_back_action); main_toolbar.add_action(go_forward_action); @@ -856,5 +856,5 @@ int run_in_windowed_mode(RefPtr config, String initial_locatio return GUI::Window::CloseRequestDecision::Close; }; - return GUI::Application::the().exec(); + return GUI::Application::the()->exec(); } -- cgit v1.2.3