Move signaling of closed channel after the coroutine has exited in delayed_unref callback, similarly to error events, so it's easier to schedule reconnect since coroutine has terminated. --- gtk/spice-channel.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/gtk/spice-channel.c b/gtk/spice-channel.c index eec63b1..faaaafe 100644 --- a/gtk/spice-channel.c +++ b/gtk/spice-channel.c @@ -2177,6 +2177,7 @@ static gboolean spice_channel_delayed_unref(gpointer data) { SpiceChannel *channel = SPICE_CHANNEL(data); SpiceChannelPrivate *c = channel->priv; + gboolean was_ready = c->state == SPICE_CHANNEL_STATE_READY; g_return_val_if_fail(channel != NULL, FALSE); CHANNEL_DEBUG(channel, "Delayed unref channel %p", channel); @@ -2190,6 +2191,9 @@ static gboolean spice_channel_delayed_unref(gpointer data) g_clear_error(&c->error); } + if (was_ready) + g_coroutine_signal_emit(channel, signals[SPICE_CHANNEL_EVENT], 0, SPICE_CHANNEL_CLOSED); + g_object_unref(G_OBJECT(data)); return FALSE; @@ -2646,9 +2650,6 @@ static void channel_disconnect(SpiceChannel *channel) c->has_error = TRUE; /* break the loop */ - if (c->state == SPICE_CHANNEL_STATE_READY) - g_coroutine_signal_emit(channel, signals[SPICE_CHANNEL_EVENT], 0, SPICE_CHANNEL_CLOSED); - spice_channel_reset(channel, FALSE); g_return_if_fail(SPICE_IS_CHANNEL(channel)); -- 2.1.0 _______________________________________________ Spice-devel mailing list Spice-devel@xxxxxxxxxxxxxxxxxxxxx http://lists.freedesktop.org/mailman/listinfo/spice-devel