From: Victor Toso <me@xxxxxxxxxxxxxx> As spice_usb_device_manager_get() can fail for different reasons, we should silently ignore it and its error. Signed-off-by: Victor Toso <victortoso@xxxxxxxxxx> --- src/spice-option.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/src/spice-option.c b/src/spice-option.c index c2b059e..c6c51a9 100644 --- a/src/spice-option.c +++ b/src/spice-option.c @@ -261,16 +261,26 @@ void spice_set_session_option(SpiceSession *session) g_object_set(session, "smartcard-db", smartcard_db, NULL); } if (usbredir_auto_redirect_filter) { - SpiceUsbDeviceManager *m = spice_usb_device_manager_get(session, NULL); - if (m) + GError *err = NULL; + SpiceUsbDeviceManager *m = spice_usb_device_manager_get(session, &err); + if (m) { g_object_set(m, "auto-connect-filter", usbredir_auto_redirect_filter, NULL); + } else { + g_warning("Option --spice-usbredir-auto-redirect-filter is set but failed: %s", err->message); + g_error_free(err); + } } if (usbredir_redirect_on_connect) { - SpiceUsbDeviceManager *m = spice_usb_device_manager_get(session, NULL); - if (m) + GError *err = NULL; + SpiceUsbDeviceManager *m = spice_usb_device_manager_get(session, &err); + if (m) { g_object_set(m, "redirect-on-connect", usbredir_redirect_on_connect, NULL); + } else { + g_warning("Option --spice-usbredir-redirect-on-connect is set but failed: %s", err->message); + g_error_free(err); + } } if (disable_usbredir) g_object_set(session, "enable-usbredir", FALSE, NULL); -- 2.21.0 _______________________________________________ Spice-devel mailing list Spice-devel@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/spice-devel