From: Alexander Nezhinsky <anezhins@xxxxxxxxxx> Signed-off-by: Alexander Nezhinsky <anezhins@xxxxxxxxxx> --- src/usb-device-widget.c | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/src/usb-device-widget.c b/src/usb-device-widget.c index 26c0db0..922108d 100644 --- a/src/usb-device-widget.c +++ b/src/usb-device-widget.c @@ -518,10 +518,27 @@ static void _disconnect_cb(GObject *gobject, GAsyncResult *res, gpointer user_da { SpiceUsbDeviceManager *manager = SPICE_USB_DEVICE_MANAGER(gobject); connect_cb_data *data = user_data; + SpiceUsbDevice *device = g_object_get_data(G_OBJECT(data->check), "usb-device"); GError *err = NULL; + gboolean rc; spice_usb_device_manager_disconnect_device_finish(manager, res, &err); - if (err) { + if (!err) { + if (spice_usb_device_manager_is_device_shared_cd(manager, device)) { + rc = spice_usb_device_manager_remove_shared_cd_device(manager, device, &err); + if (!rc) { + if (err) { + SPICE_DEBUG("Failed to remove %s, %s", + gtk_button_get_label(GTK_BUTTON(data->check)), + err->message); + g_error_free(err); + } else { + SPICE_DEBUG("Failed to remove %s", + gtk_button_get_label(GTK_BUTTON(data->check))); + } + } + } + } else { SPICE_DEBUG("Device disconnection failed"); g_error_free(err); } -- 2.20.1 _______________________________________________ Spice-devel mailing list Spice-devel@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/spice-devel