--- gtk/usb-device-manager.c | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/gtk/usb-device-manager.c b/gtk/usb-device-manager.c index a7b1140..7b27516 100644 --- a/gtk/usb-device-manager.c +++ b/gtk/usb-device-manager.c @@ -758,14 +758,15 @@ static void channel_new(SpiceSession *session, SpiceChannel *channel, { SpiceUsbDeviceManager *self = user_data; - if (SPICE_IS_USBREDIR_CHANNEL(channel)) { - spice_usbredir_channel_set_context(SPICE_USBREDIR_CHANNEL(channel), - self->priv->context); - spice_channel_connect(channel); - g_ptr_array_add(self->priv->channels, channel); + if (!SPICE_IS_USBREDIR_CHANNEL(channel)) + return; - spice_usb_device_manager_check_redir_on_connect(self, channel); - } + spice_usbredir_channel_set_context(SPICE_USBREDIR_CHANNEL(channel), + self->priv->context); + spice_channel_connect(channel); + g_ptr_array_add(self->priv->channels, channel); + + spice_usb_device_manager_check_redir_on_connect(self, channel); } static void channel_destroy(SpiceSession *session, SpiceChannel *channel, @@ -773,8 +774,10 @@ static void channel_destroy(SpiceSession *session, SpiceChannel *channel, { SpiceUsbDeviceManager *self = user_data; - if (SPICE_IS_USBREDIR_CHANNEL(channel)) - g_ptr_array_remove(self->priv->channels, channel); + if (!SPICE_IS_USBREDIR_CHANNEL(channel)) + return; + + g_ptr_array_remove(self->priv->channels, channel); } static void spice_usb_device_manager_auto_connect_cb(GObject *gobject, -- 2.1.0 _______________________________________________ Spice-devel mailing list Spice-devel@xxxxxxxxxxxxxxxxxxxxx http://lists.freedesktop.org/mailman/listinfo/spice-devel