summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Morph2021-05-18 22:21:46 -0400
committerGravatar Morph2021-05-22 03:28:54 -0400
commitecacb002beb39a2d68bf0096c31b2a62ad505e04 (patch)
tree8faf67395411a9728203053fbb3d22e8331dd07e
parentMerge pull request #6248 from A-w-x/intelmesa (diff)
downloadyuzu-ecacb002beb39a2d68bf0096c31b2a62ad505e04.tar.gz
yuzu-ecacb002beb39a2d68bf0096c31b2a62ad505e04.tar.xz
yuzu-ecacb002beb39a2d68bf0096c31b2a62ad505e04.zip
applets/swkbd: Make use of QueuedConnection in returnPressed signal
Some users have reported rare crashes when pressing the Enter key on the keyboard to confirm input in the normal software keyboard, particularly in Super Smash Bros. Ultimate while entering the name of a ruleset or controller layout. It is suspected that the QLineEdit::returnPressed signal is causing a race condition as confirming input through other means does not produce the crash. Since Qt::QueuedConnection posts an event to the event queue of the callee's thread instead of executing it directly on the caller's thread, this eliminates any potential race conditions from occurring in this scenario.
-rw-r--r--src/yuzu/applets/software_keyboard.cpp18
1 files changed, 3 insertions, 15 deletions
diff --git a/src/yuzu/applets/software_keyboard.cpp b/src/yuzu/applets/software_keyboard.cpp
index b0f764994..a9a095d58 100644
--- a/src/yuzu/applets/software_keyboard.cpp
+++ b/src/yuzu/applets/software_keyboard.cpp
@@ -720,21 +720,9 @@ void QtSoftwareKeyboardDialog::SetTextDrawType() {
720 ui->line_edit_osk->setFocus(); 720 ui->line_edit_osk->setFocus();
721 }); 721 });
722 722
723 connect(ui->line_edit_osk, &QLineEdit::returnPressed, [this] { 723 connect(
724 switch (bottom_osk_index) { 724 ui->line_edit_osk, &QLineEdit::returnPressed, this,
725 case BottomOSKIndex::LowerCase: 725 [this] { TranslateButtonPress(HIDButton::Plus); }, Qt::QueuedConnection);
726 ui->button_ok->click();
727 break;
728 case BottomOSKIndex::UpperCase:
729 ui->button_ok_shift->click();
730 break;
731 case BottomOSKIndex::NumberPad:
732 ui->button_ok_num->click();
733 break;
734 default:
735 break;
736 }
737 });
738 726
739 ui->line_edit_osk->setPlaceholderText( 727 ui->line_edit_osk->setPlaceholderText(
740 QString::fromStdU16String(initialize_parameters.guide_text)); 728 QString::fromStdU16String(initialize_parameters.guide_text));