nice, but too many lines for a single remove() in the code :)
fixed by naive iterator in patch v2.
Uri Lublin wrote:
---
This implements comment 1.
Maybe better to remove it from the list only if driver uninstall was successful
(check reply->status)
---
usbclerk.cpp | 11 +++++++++++
1 files changed, 11 insertions(+), 0 deletions(-)
diff --git a/usbclerk.cpp b/usbclerk.cpp
index b5771b7..c95766f 100644
--- a/usbclerk.cpp
+++ b/usbclerk.cpp
@@ -34,6 +34,16 @@ typedef struct USBDev {
typedef std::list<USBDev> USBDevs;
+// compare two USBDevs
+class USBDevCompare
+{
+public:
+ USBDevCompare(USBDev &ud) : d(ud) {}
+ bool operator() (const USBDev& o) { return (d.vid == o.vid && d.pid == o.pid); }
+private:
+ const UsbDev& d;
+};
+
class USBClerk {
public:
static USBClerk* get();
@@ -398,6 +408,7 @@ bool USBClerk::dispatch_message(CHAR *buffer, DWORD bytes, USBClerkReply *reply,
case USB_CLERK_DRIVER_REMOVE:
vd_printf("Removing winusb driver for %04x:%04x", dev.vid, dev.pid);
reply->status = remove_winusb_driver(dev.vid, dev.pid);
+ devs->remove_if((USBDevCompare(dev)));
break;
default:
vd_printf("Unknown message received, type %u", hdr->type);
_______________________________________________
Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
http://lists.freedesktop.org/mailman/listinfo/spice-devel