mirror of
https://github.com/spice2x/spice2x.github.io.git
synced 2026-08-04 15:50:42 -07:00
rawinput: avoid deadlock when binding analog axis as a button (#809)
## Link to GitHub Issue or related Pull Request, if one exists Regressed by #793 ## Description of change Due to lock inversion, when binding an analog axis as a button, spice deadlocks. Fix that. Also create a separate `unordered_map` that keeps track of device handles so that `WM_INPUT` handle can look up devices without having to acquire the larger `devices_mutex` which could be held by (potentially) lengthy operations like hotplug. Fix more synchronization issues around hotplug. Latent bug exposed by MIDI 2.0 issues. ## Testing
This commit is contained in:
@@ -197,8 +197,8 @@ namespace rawinput {
|
||||
HANDLE handle = INVALID_HANDLE_VALUE;
|
||||
DeviceType type = UNKNOWN;
|
||||
DeviceInfo info;
|
||||
std::mutex *mutex;
|
||||
std::mutex *mutex_out;
|
||||
std::mutex *mutex = nullptr;
|
||||
std::mutex *mutex_out = nullptr;
|
||||
bool updated = true;
|
||||
bool output_pending = true;
|
||||
bool output_enabled = false;
|
||||
@@ -213,5 +213,7 @@ namespace rawinput {
|
||||
double input_time = 0.0;
|
||||
double input_hz = 0.f;
|
||||
double input_hz_max = 0.f;
|
||||
|
||||
// when adding or removing a field, update replace_device_slot to match
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user