[Spice-devel] [PATCH spice-gtk 2/2] channel: deprecate spice_channel_destroy()

Marc-André Lureau marcandre.lureau at gmail.com
Mon Nov 10 09:16:38 PST 2014


this patch isn't working, I am fixing it

On Sun, Nov 9, 2014 at 10:00 PM, Marc-André Lureau <
marcandre.lureau at redhat.com> wrote:

> 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 | 3 ++-
>  gtk/spice-channel.h | 3 ++-
>  gtk/spice-session.c | 8 ++++----
>  3 files changed, 8 insertions(+), 6 deletions(-)
>
> diff --git a/gtk/spice-channel.c b/gtk/spice-channel.c
> index 3dd8be3..99850e3 100644
> --- a/gtk/spice-channel.c
> +++ b/gtk/spice-channel.c
> @@ -2038,8 +2038,9 @@ 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 removed
>   **/
>  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 32da7c2..493c0ab 100644
> --- a/gtk/spice-session.c
> +++ b/gtk/spice-session.c
> @@ -1664,9 +1664,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 */
>  }
>
>  /**
> @@ -1971,7 +1970,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);
> +    g_object_unref(channel);
>  }
>
>  G_GNUC_INTERNAL
> --
> 1.9.3
>
>


-- 
Marc-André Lureau
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/spice-devel/attachments/20141110/6a5c737c/attachment.html>


More information about the Spice-devel mailing list