[Spice-commits] gtk/usb-device-manager.c

Uri Lublin uril at kemper.freedesktop.org
Wed Jul 11 07:43:04 PDT 2012


 gtk/usb-device-manager.c |    7 +++++++
 1 file changed, 7 insertions(+)

New commits:
commit ac5a5b2c6aecca68a36bd6679eb1519723c9f271
Author: Uri Lublin <uril at redhat.com>
Date:   Wed Jul 11 12:01:00 2012 +0300

    usb-device-manager: do not try to connect a usb device that was removed
    
    If a device that is asked to be shared with the guest, is unplugged out
    of the machine before being redirected, then let the user know that
    usbredir of that device failed (and cleanup nicely).
    
    For Windows client, the time between request and redir is larger, as
    it includes the time it takes to install the libusb driver.

diff --git a/gtk/usb-device-manager.c b/gtk/usb-device-manager.c
index 9dab4c6..e5f84d0 100644
--- a/gtk/usb-device-manager.c
+++ b/gtk/usb-device-manager.c
@@ -1073,6 +1073,13 @@ _spice_usb_device_manager_connect_device_async(SpiceUsbDeviceManager *self,
             continue; /* Skip already used channels */
 
         libdev = spice_usb_device_manager_device_to_libdev(self, device);
+        if (libdev == NULL) {
+            g_simple_async_result_set_error(result,
+                                            SPICE_CLIENT_ERROR,
+                                            SPICE_CLIENT_ERROR_FAILED,
+                                            _("Device was not found"));
+            goto done;
+        }
         spice_usbredir_channel_connect_device_async(channel,
                                  libdev,
                                  cancellable,


More information about the Spice-commits mailing list