[Spice-devel] [PATCH spice-gtk] main: fix recent main_channel_reset() warning

Christophe Fergeau cfergeau at redhat.com
Wed Nov 20 05:20:20 PST 2013


ACK

On Wed, Nov 20, 2013 at 12:28:49PM +0100, Marc-André Lureau wrote:
> Fix wrong warning added in 0704147d.
> 
> (lt-spicy:17511):
> GSpice-WARNING **: (channel-main.c:415):spice_main_channel_reset:
> runtime check failed: (c->agent_connected == FALSE)
> ---
>  gtk/channel-main.c | 17 ++++++++---------
>  1 file changed, 8 insertions(+), 9 deletions(-)
> 
> diff --git a/gtk/channel-main.c b/gtk/channel-main.c
> index ef2a5e5..c747f0e 100644
> --- a/gtk/channel-main.c
> +++ b/gtk/channel-main.c
> @@ -171,6 +171,7 @@ static void file_xfer_continue_read(SpiceFileXferTask *task);
>  static void file_xfer_completed(SpiceFileXferTask *task, GError *error);
>  static void file_xfer_flushed(SpiceMainChannel *channel, gboolean success);
>  static void spice_main_set_max_clipboard(SpiceMainChannel *self, gint max);
> +static void set_agent_connected(SpiceMainChannel *channel, gboolean connected);
>  
>  /* ------------------------------------------------------------------ */
>  
> @@ -410,10 +411,7 @@ static void spice_main_channel_reset(SpiceChannel *channel, gboolean migrating)
>      agent_free_msg_queue(SPICE_MAIN_CHANNEL(channel));
>      c->agent_msg_queue = g_queue_new();
>  
> -    /* check: if agent_connected can be TRUE, it should call instead
> -       set_agent_connected() to notify new state */
> -    g_warn_if_fail(c->agent_connected == FALSE);
> -    spice_main_channel_reset_agent(SPICE_MAIN_CHANNEL(channel));
> +    set_agent_connected(SPICE_MAIN_CHANNEL(channel), FALSE);
>  
>      SPICE_CHANNEL_CLASS(spice_main_channel_parent_class)->channel_reset(channel, migrating);
>  }
> @@ -1432,6 +1430,10 @@ static void set_agent_connected(SpiceMainChannel *channel, gboolean connected)
>          c->agent_connected = connected;
>          g_object_notify_main_context(G_OBJECT(channel), "agent-connected");
>      }
> +    if (!connected)
> +        spice_main_channel_reset_agent(SPICE_MAIN_CHANNEL(channel));
> +
> +    emit_main_context(channel, SPICE_MAIN_AGENT_UPDATE);
>  }
>  
>  /* coroutine context  */
> @@ -1443,9 +1445,8 @@ static void agent_start(SpiceMainChannel *channel)
>      };
>      SpiceMsgOut *out;
>  
> -    set_agent_connected(channel, TRUE);
>      c->agent_caps_received = false;
> -    emit_main_context(channel, SPICE_MAIN_AGENT_UPDATE);
> +    set_agent_connected(channel, TRUE);
>  
>      out = spice_msg_out_new(SPICE_CHANNEL(channel), SPICE_MSGC_MAIN_AGENT_START);
>      out->marshallers->msgc_main_agent_start(out->marshaller, &agent_start);
> @@ -1460,9 +1461,7 @@ static void agent_start(SpiceMainChannel *channel)
>  /* coroutine context  */
>  static void agent_stopped(SpiceMainChannel *channel)
>  {
> -    set_agent_connected(channel, FALSE); /* For notify */
> -    spice_main_channel_reset_agent(channel);
> -    emit_main_context(channel, SPICE_MAIN_AGENT_UPDATE);
> +    set_agent_connected(channel, FALSE);
>  }
>  
>  /* coroutine context */
> -- 
> 1.8.3.1
> 
> _______________________________________________
> Spice-devel mailing list
> Spice-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/spice-devel
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/spice-devel/attachments/20131120/7e11fa85/attachment.pgp>


More information about the Spice-devel mailing list