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/Browser/Tab.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'Applications/Browser') diff --git a/Applications/Browser/Tab.cpp b/Applications/Browser/Tab.cpp index aed2949e66..7c56f4ad7d 100644 --- a/Applications/Browser/Tab.cpp +++ b/Applications/Browser/Tab.cpp @@ -254,7 +254,7 @@ Tab::Tab() app_menu.add_action(*m_reload_action); app_menu.add_separator(); app_menu.add_action(GUI::CommonActions::make_quit_action([](auto&) { - GUI::Application::the().quit(); + GUI::Application::the()->quit(); })); auto& view_menu = m_menubar->add_menu("View"); @@ -429,7 +429,7 @@ void Tab::did_become_active() m_toolbar_container->set_visible(!is_fullscreen); m_statusbar->set_visible(!is_fullscreen); - GUI::Application::the().set_menubar(m_menubar); + GUI::Application::the()->set_menubar(m_menubar); } void Tab::context_menu_requested(const Gfx::IntPoint& screen_position) -- cgit v1.2.3