From: Alexander Nezhinsky <anezhins@xxxxxxxxxx> Some corner error scenarios may leave dangling not connected shared CD devices. As the current flow precludes maintenance of such devices, it may be prudent to identify and remove them. Signed-off-by: Alexander Nezhinsky <anezhins@xxxxxxxxxx> --- src/usb-device-widget.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/usb-device-widget.c b/src/usb-device-widget.c index a8219e5..c635a36 100644 --- a/src/usb-device-widget.c +++ b/src/usb-device-widget.c @@ -294,9 +294,19 @@ static void spice_usb_device_widget_constructed(GObject *gobject) devices = spice_usb_device_manager_get_devices(priv->manager); if (devices != NULL) { + SpiceUsbDevice *device; int i; + for (i = 0; i < devices->len; i++) { - device_added_cb(NULL, g_ptr_array_index(devices, i), self); + device = g_ptr_array_index(devices, i); + + if (spice_usb_device_manager_is_device_shared_cd(priv->manager, device) && + !spice_usb_device_manager_is_device_connected(priv->manager, device)) { + spice_usb_device_manager_remove_shared_cd_device(priv->manager, device, NULL); + continue; + } + + device_added_cb(NULL, device, self); } g_ptr_array_unref(devices); -- 2.20.1 _______________________________________________ Spice-devel mailing list Spice-devel@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/spice-devel