Everywhere: Replace most cases of exit() with Application::quit()

Application::quit() is nicer for most cases where exit() is used. Cases
where exit() is used intentionally for early termination are left
intact.
This commit is contained in:
Timothy 2021-08-03 22:05:07 +10:00 committed by Andreas Kling
parent 2caafacd9b
commit 73c1b1617a
Notes: sideshowbarker 2024-07-18 07:31:20 +09:00
5 changed files with 12 additions and 11 deletions

View file

@ -250,7 +250,7 @@ int main(int argc, char** argv)
if (!app_state.selected_index.has_value())
return;
app_state.results[app_state.selected_index.value()].activate();
exit(0);
GUI::Application::the()->quit();
};
text_box.on_up_pressed = [&]() {
if (!app_state.visible_result_count)
@ -278,7 +278,7 @@ int main(int argc, char** argv)
mark_selected_item();
};
text_box.on_escape_pressed = []() {
exit(0);
GUI::Application::the()->quit();
};
db.on_new_results = [&](auto results) {
@ -298,7 +298,7 @@ int main(int argc, char** argv)
match.set_subtitle(result.subtitle());
match.on_selected = [&result]() {
result.activate();
exit(0);
GUI::Application::the()->quit();
};
}

View file

@ -73,8 +73,10 @@ void IRCAppWindow::setup_client()
if (m_client->hostname().is_empty()) {
String value;
if (GUI::InputBox::show(this, value, "Enter server:", "Connect to server") == GUI::InputBox::ExecCancel)
::exit(0);
if (GUI::InputBox::show(this, value, "Enter server:", "Connect to server") == GUI::InputBox::ExecCancel) {
GUI::Application::the()->quit();
return;
}
m_client->set_server(value, 6667);
}

View file

@ -52,18 +52,18 @@ void Screensaver::mousemove_event(GUI::MouseEvent& event)
if (m_mouse_origin.is_null()) {
m_mouse_origin = event.position();
} else if (event.position().distance_from(m_mouse_origin) > max_distance_move) {
::exit(0);
GUI::Application::the()->quit();
}
}
void Screensaver::mousedown_event(GUI::MouseEvent&)
{
::exit(0);
GUI::Application::the()->quit();
}
void Screensaver::keydown_event(GUI::KeyEvent&)
{
::exit(0);
GUI::Application::the()->quit();
}
void Screensaver::paint_event(GUI::PaintEvent& event)

View file

@ -79,12 +79,12 @@ void Starfield::mousemove_event(GUI::MouseEvent&)
void Starfield::mousedown_event(GUI::MouseEvent&)
{
::exit(0);
GUI::Application::the()->quit();
}
void Starfield::keydown_event(GUI::KeyEvent&)
{
::exit(0);
GUI::Application::the()->quit();
}
void Starfield::paint_event(GUI::PaintEvent& event)

View file

@ -34,7 +34,6 @@ void ClientConnection::die()
{
s_connections.remove(client_id());
GUI::Application::the()->quit();
exit(0);
}
RefPtr<GUI::Window> ClientConnection::create_dummy_child_window(i32 window_server_client_id, i32 parent_window_id)