From 5132d4672c65129841869da897d087c721beab28 Mon Sep 17 00:00:00 2001
From: Victor Toso <me@victortoso.com>
Date: Wed, 5 Sep 2018 15:43:28 +0200
Subject: [PATCH] channel-usbredir: Chain-up with parent's channel-reset
Otherwise spice-channel is left with a broken state.
This code moves parent's call to channel_reset() into
_channel_reset_finish() - Note that spice-channel's channel_reset()
can be called from GMainContext.
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1625550
Signed-off-by: Victor Toso <victortoso@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
(cherry picked from commit 3afee7ae8db387e7f4339f2a4afaa63babf358b7)
---
src/channel-usbredir.c | 11 +++++------
1 file changed, 5 insertions(+), 6 deletions(-)
diff --git a/src/channel-usbredir.c b/src/channel-usbredir.c
index 13927cc..870938b 100644
--- a/src/channel-usbredir.c
+++ b/src/channel-usbredir.c
@@ -122,7 +122,7 @@ static void spice_usbredir_channel_init(SpiceUsbredirChannel *channel)
#ifdef USE_USBREDIR
-static void _channel_reset_finish(SpiceUsbredirChannel *channel)
+static void _channel_reset_finish(SpiceUsbredirChannel *channel, gboolean migrating)
{
SpiceUsbredirChannelPrivate *priv = channel->priv;
@@ -135,6 +135,8 @@ static void _channel_reset_finish(SpiceUsbredirChannel *channel)
spice_usbredir_channel_set_context(channel, priv->context);
spice_usbredir_channel_unlock(channel);
+
+ SPICE_CHANNEL_CLASS(spice_usbredir_channel_parent_class)->channel_reset(SPICE_CHANNEL(channel), migrating);
}
static void _channel_reset_cb(GObject *gobject,
@@ -146,9 +148,7 @@ static void _channel_reset_cb(GObject *gobject,
gboolean migrating = GPOINTER_TO_UINT(user_data);
GError *err = NULL;
- _channel_reset_finish(channel);
-
- SPICE_CHANNEL_CLASS(spice_usbredir_channel_parent_class)->channel_reset(spice_channel, migrating);
+ _channel_reset_finish(channel, migrating);
spice_usbredir_channel_disconnect_device_finish(channel, result, &err);
}
@@ -177,8 +177,7 @@ static void spice_usbredir_channel_reset(SpiceChannel *c, gboolean migrating)
return;
}
- /* FIXME: This does not chain-up with parent's channel-reset, which is a must */
- _channel_reset_finish(channel);
+ _channel_reset_finish(channel, migrating);
}
#endif
--
2.20.1