summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUri Lublin <uril@redhat.com>2012-07-11 12:01:00 +0300
committerUri Lublin <uril@redhat.com>2012-07-11 17:41:09 +0300
commitac5a5b2c6aecca68a36bd6679eb1519723c9f271 (patch)
tree0772a61a7b2cf2a27ed87d1065389b5d3392e253
parentf16520755d7e03df220a5600c30cb41a866e742b (diff)
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.
-rw-r--r--gtk/usb-device-manager.c7
1 files changed, 7 insertions, 0 deletions
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,