diff options
Diffstat (limited to 'opentrack')
| -rw-r--r-- | opentrack/win32-joystick.cpp | 8 | 
1 files changed, 5 insertions, 3 deletions
diff --git a/opentrack/win32-joystick.cpp b/opentrack/win32-joystick.cpp index 6e64355c..0f8a08f8 100644 --- a/opentrack/win32-joystick.cpp +++ b/opentrack/win32-joystick.cpp @@ -222,7 +222,7 @@ win32_joy_ctx::enum_state::enum_state(std::unordered_map<QString, std::shared_pt          QMutexLocker l(&mtx);          this->joys = joys;      } -     +      if(FAILED(hr = di->EnumDevices(DI8DEVCLASS_GAMECTRL,                                     EnumJoysticksCallback,                                     this, @@ -232,10 +232,12 @@ win32_joy_ctx::enum_state::enum_state(std::unordered_map<QString, std::shared_pt          return;      } -    for (auto it = this->joys.begin(); it != this->joys.end(); ) +    auto& js = this->joys; +     +    for (auto it = js.begin(); it != js.end(); )      {          if (std::find_if(all.cbegin(), all.cend(), [&](const QString& guid2) -> bool { return it->second->guid == guid2; }) == all.cend()) -            it = joys.erase(it); +            it = js.erase(it);          else              it++;      }  | 
