[Spice-devel] [PATCH spice-gtk] usb-device-manager: Fix coldplug race

Hans de Goede hdegoede at redhat.com
Mon Feb 11 11:32:21 PST 2013


It is possible for us to see a device show up twice, if it gets plugged
in between us starting listening for new devices and doing "coldplug", then
it will get added once from the coldplug code, and then again from from
the hotplug code path. We already have code checking for this, but the check
is only compiled in under Windows -> Remove the #ifdef to also catch this
under Linux.

Signed-off-by: Hans de Goede <hdegoede at redhat.com>
---
 gtk/usb-device-manager.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/gtk/usb-device-manager.c b/gtk/usb-device-manager.c
index 3f4c272..34ff37c 100644
--- a/gtk/usb-device-manager.c
+++ b/gtk/usb-device-manager.c
@@ -699,13 +699,11 @@ static void spice_usb_device_manager_add_dev(SpiceUsbDeviceManager  *self,
         return;
     }
 
-#ifdef G_OS_WIN32
     device = spice_usb_device_manager_find_device(self, bus, address);
     if (device) {
         SPICE_DEBUG("USB device at %d.%d already exists, ignored", bus, address);
         return;
     }
-#endif
 
     if (priv->coldplug_list)
         dev_list = priv->coldplug_list;
-- 
1.8.1.2



More information about the Spice-devel mailing list