[Spice-commits] gtk/channel-usbredir.c

Pavel Grunt pgrunt at kemper.freedesktop.org
Thu Mar 12 07:31:19 PDT 2015


 gtk/channel-usbredir.c |    9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

New commits:
commit e3932bfebbfec7637f3d03d90e8f9b75e3223236
Author: Pavel Grunt <pgrunt at redhat.com>
Date:   Wed Mar 11 16:31:39 2015 +0100

    channel-usbredir: Do not stop event listening if SpiceSession does not exist
    
    Avoids Segfault when closing the connection just after the usb device redirection.

diff --git a/gtk/channel-usbredir.c b/gtk/channel-usbredir.c
index b1a91fb..d974434 100644
--- a/gtk/channel-usbredir.c
+++ b/gtk/channel-usbredir.c
@@ -419,9 +419,12 @@ void spice_usbredir_channel_disconnect_device(SpiceUsbredirChannel *channel)
          * usbredirhost_set_device NULL will interrupt the
          * libusb_handle_events call in the thread.
          */
-        spice_usb_device_manager_stop_event_listening(
-            spice_usb_device_manager_get(
-                spice_channel_get_session(SPICE_CHANNEL(channel)), NULL));
+        {
+            SpiceSession *session = spice_channel_get_session(SPICE_CHANNEL(channel));
+            if (session != NULL)
+                spice_usb_device_manager_stop_event_listening(
+                    spice_usb_device_manager_get(session, NULL));
+        }
         /* This also closes the libusb handle we passed from open_device */
         usbredirhost_set_device(priv->host, NULL);
         libusb_unref_device(priv->device);


More information about the Spice-commits mailing list