mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 02:17:34 +00:00
SystemMonitor: Don't try and show process window with nothing selected (#7221)
When right-clicking with no selected row in the process list, SystemMonitor would still show a context menu. This disables the context menu if index is invalid and also disables Alt+Enter so that build_process_window() is never called with a PID of -1. Fixes #7167.
This commit is contained in:
parent
325febf4e5
commit
63897c469b
1 changed files with 4 additions and 1 deletions
|
@ -307,6 +307,8 @@ int main(int argc, char** argv)
|
||||||
auto process_properties_action = GUI::CommonActions::make_properties_action(
|
auto process_properties_action = GUI::CommonActions::make_properties_action(
|
||||||
[&](auto&) {
|
[&](auto&) {
|
||||||
auto pid = selected_id(ProcessModel::Column::PID);
|
auto pid = selected_id(ProcessModel::Column::PID);
|
||||||
|
if (pid == -1)
|
||||||
|
return;
|
||||||
|
|
||||||
RefPtr<GUI::Window> process_window;
|
RefPtr<GUI::Window> process_window;
|
||||||
auto it = process_windows.find(pid);
|
auto it = process_windows.find(pid);
|
||||||
|
@ -341,7 +343,8 @@ int main(int argc, char** argv)
|
||||||
process_context_menu->add_separator();
|
process_context_menu->add_separator();
|
||||||
process_context_menu->add_action(process_properties_action);
|
process_context_menu->add_action(process_properties_action);
|
||||||
process_table_view.on_context_menu_request = [&]([[maybe_unused]] const GUI::ModelIndex& index, const GUI::ContextMenuEvent& event) {
|
process_table_view.on_context_menu_request = [&]([[maybe_unused]] const GUI::ModelIndex& index, const GUI::ContextMenuEvent& event) {
|
||||||
process_context_menu->popup(event.screen_position(), process_properties_action);
|
if (index.is_valid())
|
||||||
|
process_context_menu->popup(event.screen_position(), process_properties_action);
|
||||||
};
|
};
|
||||||
|
|
||||||
auto& frequency_menu = menubar->add_menu("F&requency");
|
auto& frequency_menu = menubar->add_menu("F&requency");
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue