mirror of
https://github.com/RGBCube/serenity
synced 2025-05-16 19:45:07 +00:00
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.
This commit is contained in:
parent
f7577585a6
commit
ca93c22ae2
26 changed files with 51 additions and 49 deletions
|
@ -368,7 +368,7 @@ TextEditorWidget::TextEditorWidget()
|
|||
app_menu.add_action(GUI::CommonActions::make_quit_action([this](auto&) {
|
||||
if (!request_close())
|
||||
return;
|
||||
GUI::Application::the().quit(0);
|
||||
GUI::Application::the()->quit();
|
||||
}));
|
||||
|
||||
auto& edit_menu = menubar->add_menu("Edit");
|
||||
|
@ -455,7 +455,7 @@ TextEditorWidget::TextEditorWidget()
|
|||
GUI::AboutDialog::show("Text Editor", Gfx::Bitmap::load_from_file("/res/icons/32x32/app-texteditor.png"), window());
|
||||
}));
|
||||
|
||||
GUI::Application::the().set_menubar(move(menubar));
|
||||
GUI::Application::the()->set_menubar(move(menubar));
|
||||
|
||||
toolbar.add_action(*m_new_action);
|
||||
toolbar.add_action(*m_open_action);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue