diff options
| author | spycrab <spycrab@users.noreply.github.com> | 2018-08-11 17:37:12 +0200 |
|---|---|---|
| committer | spycrab <spycrab@users.noreply.github.com> | 2018-08-11 17:37:12 +0200 |
| commit | 159d5a69251be51efbbe4be3cd4e2d9b0be5182a (patch) | |
| tree | 656fd2238ce624368b8d2b38995be740c82b6541 /Source | |
| parent | a2b97665bb88e4408c120db95082b6fc3033c91b (diff) | |
Qt/MappingButton: Fix crash when exiting during input detection
Diffstat (limited to 'Source')
| -rw-r--r-- | Source/Core/DolphinQt/Config/Mapping/MappingButton.cpp | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/Source/Core/DolphinQt/Config/Mapping/MappingButton.cpp b/Source/Core/DolphinQt/Config/Mapping/MappingButton.cpp index 0e575a774b..343b522704 100644 --- a/Source/Core/DolphinQt/Config/Mapping/MappingButton.cpp +++ b/Source/Core/DolphinQt/Config/Mapping/MappingButton.cpp @@ -3,7 +3,6 @@ // Refer to the license.txt file included. #include <future> -#include <thread> #include <utility> #include <QApplication> @@ -23,6 +22,7 @@ #include "DolphinQt/Config/Mapping/MappingWidget.h" #include "DolphinQt/Config/Mapping/MappingWindow.h" #include "DolphinQt/QtUtils/BlockUserInputFilter.h" +#include "DolphinQt/QtUtils/QueueOnObject.h" #include "DolphinQt/Settings.h" #include "InputCommon/ControlReference/ControlReference.h" @@ -110,9 +110,12 @@ void MappingButton::Detect() grabKeyboard(); // Make sure that we don't block event handling - std::thread thread([this] { + QueueOnObject(this, [this] { setText(QStringLiteral("...")); + // The button text won't be updated if we don't process events here + QApplication::processEvents(); + // Avoid that the button press itself is registered as an event Common::SleepCurrentThread(100); @@ -188,8 +191,6 @@ void MappingButton::Detect() OnButtonTimeout(); } }); - - thread.detach(); } void MappingButton::OnButtonTimeout() |
