Commit c5e1504d authored by Reilly Grant's avatar Reilly Grant Committed by Commit Bot

usb: Fix loop to close handles on disconnect

When platform-specific logic from UsbDeviceImpl and UsbDeviceLinux was
marged into UsbDevice the version from UsbDeviceLinux, which incorrectly
iterated over the swapped list of open handles, was used. This change
fixes that typo so that handles are once again closed when the device is
disconnected.

Bug: 1106051
Change-Id: I53eabd25b5799d32d2db7da5665b481abade2d11
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2300880
Auto-Submit: Reilly Grant <reillyg@chromium.org>
Reviewed-by: default avatarJames Hollyer <jameshollyer@chromium.org>
Commit-Queue: Reilly Grant <reillyg@chromium.org>
Cr-Commit-Position: refs/heads/master@{#794359}
parent e0edeb44
...@@ -118,7 +118,7 @@ void UsbDevice::OnDisconnect() { ...@@ -118,7 +118,7 @@ void UsbDevice::OnDisconnect() {
// Swap out the handle list as HandleClosed() will try to modify it. // Swap out the handle list as HandleClosed() will try to modify it.
std::list<UsbDeviceHandle*> handles; std::list<UsbDeviceHandle*> handles;
handles.swap(handles_); handles.swap(handles_);
for (auto* handle : handles_) for (auto* handle : handles)
handle->Close(); handle->Close();
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment