[Spice-commits] src/spice-session.c

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Sat Jan 5 10:25:19 UTC 2019


 src/spice-session.c |   12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

New commits:
commit 5b70ab48a030c4388aa4709069042e7ab624024f
Author: Marc-André Lureau <marcandre.lureau at redhat.com>
Date:   Tue Nov 29 22:34:04 2016 +0100

    session: initialize USB device manager on session creation
    
    Simple command line tools simply connect all channels, however
    usbredir channels require that the manager was previously
    initialized. Currently, running spicy-stats on a VM with usbredir
    channels prints:
    
    (lt-spicy-stats:25224): GSpice-CRITICAL **: 14:30:54.724: spice_usbredir_channel_up: assertion 'priv->host != NULL' failed
    
    (lt-spicy-stats:25224): GSpice-CRITICAL **: 14:30:54.724: usbredir_handle_msg: assertion 'priv->host != NULL' failed
    
    There is not strong reason not to initialize the USB device manager
    when the session is created.
    
    Notes:
    - when usbredir isn't compiled in, those criticals aren't reached
    - a previous attempt was to initialize the usb device manager during
      session instance init, however the manager shouldn't interact with a
      temporary migration session
    
    Fixes:
    https://gitlab.freedesktop.org/spice/spice-gtk/issues/67
    
    Signed-off-by: Marc-André Lureau <marcandre.lureau at redhat.com>
    Reviewed-by: Christophe Fergeau <cfergeau at redhat.com>

diff --git a/src/spice-session.c b/src/spice-session.c
index 74c1f6e..5609c9b 100644
--- a/src/spice-session.c
+++ b/src/spice-session.c
@@ -1535,7 +1535,17 @@ gboolean spice_session_get_gl_scanout_enabled(SpiceSession *session)
  **/
 SpiceSession *spice_session_new(void)
 {
-    return SPICE_SESSION(g_object_new(SPICE_TYPE_SESSION, NULL));
+    SpiceSession *self = SPICE_SESSION(g_object_new(SPICE_TYPE_SESSION, NULL));
+    SpiceSessionPrivate *priv = self->priv;
+    GError *err = NULL;
+
+    priv->usb_manager = spice_usb_device_manager_get(self, &err);
+    if (err != NULL) {
+        SPICE_DEBUG("Could not initialize SpiceUsbDeviceManager - %s", err->message);
+        g_clear_error(&err);
+    }
+
+    return self;
 }
 
 G_GNUC_INTERNAL


More information about the Spice-commits mailing list