red-channel-client: Init pipe field during init

There was a chance that on error GQueue were not
initialized but an attempt to destroy it is made.
This ensures GQueue is initialized as soon as
possible. Note that red_channel_client_initable_init
is called after all init and construction callbacks.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
This commit is contained in:
Frediano Ziglio 2016-10-27 13:24:20 +01:00
parent 2837896974
commit f5c0e555d3

View File

@ -354,6 +354,8 @@ red_channel_client_init(RedChannelClient *self)
self->priv->send_data.urgent.marshaller = spice_marshaller_new();
self->priv->send_data.marshaller = self->priv->send_data.main.marshaller;
g_queue_init(&self->priv->pipe);
}
RedChannel* red_channel_client_get_channel(RedChannelClient *rcc)
@ -907,7 +909,6 @@ static gboolean red_channel_client_initable_init(GInitable *initable,
self->priv->outgoing.pos = 0;
self->priv->outgoing.size = 0;
g_queue_init(&self->priv->pipe);
if (self->priv->stream)
self->priv->stream->watch =
core->watch_add(core, self->priv->stream->socket,