This function is somewhat useless, and dangerous since it is calling g_object_unref() on your back (although this is mention in the doc, I consider this a bad practice). --- gtk/spice-channel.c | 6 +++++- gtk/spice-channel.h | 3 ++- gtk/spice-session.c | 8 ++++---- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/gtk/spice-channel.c b/gtk/spice-channel.c index 7c18d87..ea0ed34 100644 --- a/gtk/spice-channel.c +++ b/gtk/spice-channel.c @@ -2038,8 +2038,12 @@ SpiceChannel *spice_channel_new(SpiceSession *s, int type, int id) * spice_channel_destroy: * @channel: * - * Disconnect and unref the @channel. Called by @spice_session_channel_destroy() + * Disconnect and unref the @channel. * + * Deprecated: 0.27: this function has been deprecated because it is + * misleading, the object is not actually destroyed. Instead, it is + * recommended to call explicitely spice_channel_disconnect() and + * g_object_unref(). **/ void spice_channel_destroy(SpiceChannel *channel) { diff --git a/gtk/spice-channel.h b/gtk/spice-channel.h index 1c303b4..8d07383 100644 --- a/gtk/spice-channel.h +++ b/gtk/spice-channel.h @@ -107,7 +107,6 @@ GType spice_channel_get_type(void); typedef void (*spice_msg_handler)(SpiceChannel *channel, SpiceMsgIn *in); SpiceChannel *spice_channel_new(SpiceSession *s, int type, int id); -void spice_channel_destroy(SpiceChannel *channel); gboolean spice_channel_connect(SpiceChannel *channel); gboolean spice_channel_open_fd(SpiceChannel *channel, int fd); void spice_channel_disconnect(SpiceChannel *channel, SpiceChannelEvent reason); @@ -118,6 +117,8 @@ gboolean spice_channel_flush_finish(SpiceChannel *channel, GAsyncResult *result, #ifndef SPICE_DISABLE_DEPRECATED SPICE_DEPRECATED void spice_channel_set_capability(SpiceChannel *channel, guint32 cap); +SPICE_DEPRECATED +void spice_channel_destroy(SpiceChannel *channel); #endif const gchar* spice_channel_type_to_string(gint type); diff --git a/gtk/spice-session.c b/gtk/spice-session.c index 35b43e6..b9a0ee9 100644 --- a/gtk/spice-session.c +++ b/gtk/spice-session.c @@ -1758,9 +1758,8 @@ void spice_session_disconnect(SpiceSession *session) memset(s->uuid, 0, sizeof(s->uuid)); spice_session_abort_migration(session); - /* we leave disconnecting = TRUE, so that spice_channel_destroy() - is not called multiple times on channels that are in pending - destroy state. */ + /* we leave disconnecting = TRUE, so that spice_channel_disconnect() + is not called multiple times */ } /** @@ -2068,7 +2067,8 @@ static void spice_session_channel_destroy(SpiceSession *session, SpiceChannel *c g_signal_emit(session, signals[SPICE_SESSION_CHANNEL_DESTROY], 0, channel); g_clear_object(&channel->priv->session); - spice_channel_destroy(channel); + spice_channel_disconnect(channel, SPICE_CHANNEL_NONE); + g_object_unref(channel); } G_GNUC_INTERNAL -- 2.1.0 _______________________________________________ Spice-devel mailing list Spice-devel@xxxxxxxxxxxxxxxxxxxxx http://lists.freedesktop.org/mailman/listinfo/spice-devel