1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 15:48:12 +00:00

LibGfx: Use "try_" prefix for static factory functions

Also mark them as [[nodiscard]].
This commit is contained in:
Andreas Kling 2021-07-21 18:02:15 +02:00
parent f0409081f5
commit c7d891765c
131 changed files with 422 additions and 421 deletions

View file

@ -243,7 +243,7 @@ int main(int argc, char** argv)
};
auto kill_action = GUI::Action::create(
"&Kill Process", { Mod_Ctrl, Key_K }, Gfx::Bitmap::load_from_file("/res/icons/16x16/kill.png"), [&](const GUI::Action&) {
"&Kill Process", { Mod_Ctrl, Key_K }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/kill.png"), [&](const GUI::Action&) {
pid_t pid = selected_id(ProcessModel::Column::PID);
if (pid != -1)
kill(pid, SIGKILL);
@ -251,7 +251,7 @@ int main(int argc, char** argv)
&process_table_view);
auto stop_action = GUI::Action::create(
"&Stop Process", { Mod_Ctrl, Key_S }, Gfx::Bitmap::load_from_file("/res/icons/16x16/stop-hand.png"), [&](const GUI::Action&) {
"&Stop Process", { Mod_Ctrl, Key_S }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/stop-hand.png"), [&](const GUI::Action&) {
pid_t pid = selected_id(ProcessModel::Column::PID);
if (pid != -1)
kill(pid, SIGSTOP);
@ -259,7 +259,7 @@ int main(int argc, char** argv)
&process_table_view);
auto continue_action = GUI::Action::create(
"&Continue Process", { Mod_Ctrl, Key_C }, Gfx::Bitmap::load_from_file("/res/icons/16x16/continue.png"), [&](const GUI::Action&) {
"&Continue Process", { Mod_Ctrl, Key_C }, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/continue.png"), [&](const GUI::Action&) {
pid_t pid = selected_id(ProcessModel::Column::PID);
if (pid != -1)
kill(pid, SIGCONT);
@ -268,7 +268,7 @@ int main(int argc, char** argv)
auto profile_action = GUI::Action::create(
"&Profile Process", { Mod_Ctrl, Key_P },
Gfx::Bitmap::load_from_file("/res/icons/16x16/app-profiler.png"), [&](auto&) {
Gfx::Bitmap::try_load_from_file("/res/icons/16x16/app-profiler.png"), [&](auto&) {
pid_t pid = selected_id(ProcessModel::Column::PID);
if (pid != -1) {
auto pid_string = String::number(pid);