mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-26 09:30:24 +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
Notes:
sideshowbarker
2024-07-18 17:53:12 +09:00
Author: https://github.com/metmo 🔰 Commit: https://github.com/SerenityOS/serenity/commit/63897c469bb Pull-request: https://github.com/SerenityOS/serenity/pull/7221 Issue: https://github.com/SerenityOS/serenity/issues/7167
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&) {
|
||||
auto pid = selected_id(ProcessModel::Column::PID);
|
||||
if (pid == -1)
|
||||
return;
|
||||
|
||||
RefPtr<GUI::Window> process_window;
|
||||
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_action(process_properties_action);
|
||||
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");
|
||||
|
|
Loading…
Reference in a new issue