mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-09-09 11:06:10 +00:00
SystemMonitor: Only update kill actions when pid changes
Return early from on_selection_change if the pid hasn't changed or we get an invalid result from selected_id().
This commit is contained in:
parent
5fbb476856
commit
ebb96b7fea
Notes:
sideshowbarker
2024-07-18 07:48:08 +09:00
Author: https://github.com/metmo
Commit: ebb96b7fea
Pull-request: https://github.com/SerenityOS/serenity/pull/9064
Reviewed-by: https://github.com/awesomekling
1 changed files with 5 additions and 0 deletions
|
@ -353,8 +353,13 @@ int main(int argc, char** argv)
|
||||||
process_properties_action->activate();
|
process_properties_action->activate();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static pid_t last_selected_pid;
|
||||||
|
|
||||||
process_table_view.on_selection_change = [&] {
|
process_table_view.on_selection_change = [&] {
|
||||||
pid_t pid = selected_id(ProcessModel::Column::PID);
|
pid_t pid = selected_id(ProcessModel::Column::PID);
|
||||||
|
if (pid == last_selected_pid || pid < 1)
|
||||||
|
return;
|
||||||
|
last_selected_pid = pid;
|
||||||
bool has_access = can_access_pid(pid);
|
bool has_access = can_access_pid(pid);
|
||||||
kill_action->set_enabled(has_access);
|
kill_action->set_enabled(has_access);
|
||||||
stop_action->set_enabled(has_access);
|
stop_action->set_enabled(has_access);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue