Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 3160a250 authored by Treehugger Robot's avatar Treehugger Robot Committed by Gerrit Code Review
Browse files

Merge changes I6c6bf61b,I3fb0b3a8

* changes:
  adb: libusb: don't try to delete a usb_handle twice.
  adb: don't hold queue lock while performing callbacks.
parents d105aa84 60b8c265
Loading
Loading
Loading
Loading
+9 −4
Original line number Diff line number Diff line
@@ -74,13 +74,18 @@ class BlockingQueue {

    template <typename Fn>
    void PopAll(Fn fn) {
        std::vector<T> popped;

        {
            std::unique_lock<std::mutex> lock(mutex);
            cv.wait(lock, [this]() { return !queue.empty(); });
            popped = std::move(queue);
            queue.clear();
        }

        for (const T& t : queue) {
        for (const T& t : popped) {
            fn(t);
        }
        queue.clear();
    }
};

+3 −1
Original line number Diff line number Diff line
@@ -422,8 +422,10 @@ static void device_disconnected(libusb_device* device) {
        if (!it->second->device_handle) {
            // If the handle is null, we were never able to open the device.
            unregister_usb_transport(it->second.get());
        }
            usb_handles.erase(it);
        } else {
            // Closure of the transport will erase the usb_handle.
        }
    }
}