mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-08-01 02:29:59 -06:00

This gets rid of the ugly direct access to USBScanner::m_devices that was introduced by the previous commit. This also fixes a potential thread safety issue. USB_HIDv4::TriggerDeviceChangeReply loops through m_devices and calls GetDeviceEntry for each device. If USB_HIDv4::TriggerDeviceChangeReply is called after a new device is added to m_devices but before hooks are dispatched, GetDeviceEntry crashes, because the hook that's supposed to update m_device_ids hasn't run yet. With this commit, this issue can no longer happen, because USBHost::m_devices_mutex doesn't get unlocked in between updating m_devices and dispatching the hooks.