From cb8a240f1a8205bcf3f5de4e0315a44cfa8683bb Mon Sep 17 00:00:00 2001 From: Megamouse Date: Fri, 21 Oct 2022 22:58:39 +0200 Subject: [PATCH] Qt/Input: Properly clear pad selection in pad settings Fixes a rare issue that causes a newly selected pad handler with no pads to try to connect a previously selected pad from another handler. --- rpcs3/rpcs3qt/pad_settings_dialog.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/rpcs3/rpcs3qt/pad_settings_dialog.cpp b/rpcs3/rpcs3qt/pad_settings_dialog.cpp index e404ec4a40..875db6764a 100644 --- a/rpcs3/rpcs3qt/pad_settings_dialog.cpp +++ b/rpcs3/rpcs3qt/pad_settings_dialog.cpp @@ -1443,7 +1443,7 @@ void pad_settings_dialog::ChangeHandler() ui->chooseDevice->blockSignals(false); // Handle empty device list - bool config_enabled = force_enable || (m_handler->m_type != pad_handler::null && ui->chooseDevice->count() > 0); + const bool config_enabled = force_enable || (m_handler->m_type != pad_handler::null && ui->chooseDevice->count() > 0); if (config_enabled) { @@ -1454,9 +1454,15 @@ void pad_settings_dialog::ChangeHandler() if (pad_device_info info = get_pad_info(ui->chooseDevice, i); info.name == device) { ui->chooseDevice->setCurrentIndex(i); + break; } } + if (ui->chooseDevice->currentIndex() < 0 && ui->chooseDevice->count() > 0) + { + ui->chooseDevice->setCurrentIndex(0); + } + // Force Refresh ChangeDevice(ui->chooseDevice->currentIndex()); } @@ -1466,6 +1472,8 @@ void pad_settings_dialog::ChangeHandler() { ui->chooseDevice->setPlaceholderText(tr("No Device Detected")); } + + m_device_name.clear(); } // Handle running timers