[Spice-devel] [spice-gtk] Don't call channel_connect from channel_disconnect in SWITCHING state
Christophe Fergeau
cfergeau at redhat.com
Thu Jan 29 07:11:33 PST 2015
On Thu, Jan 29, 2015 at 07:22:59AM -0500, Marc-André Lureau wrote:
> Now that connect() actually happens as it should imho,
> the two lines could be swapped, that should remove the warning.
>
> I am a bit worried about the connect_delayed() resetting the coroutine
> that might not be finished, it should probably resume it until it ends.
Indeed...
Looking at the end of spice_channel_coroutine(), we have
SPICE_CHANNEL_GET_CLASS(channel)->channel_disconnect(channel);
/* snip */
g_idle_add(spice_channel_delayed_unref, data);
In the SPICE_CHANNEL_STATE_SWITCHING state, channel_disconnect()
will call channel_connect which will do
c->connect_delayed_id = g_idle_add(connect_delayed, channel);
So connect_delayed will be called before spice_channel_delayed_unref,
and will reset the coroutine, then _delayed_unref will be called and
will trip on
g_return_val_if_fail(c->coroutine.coroutine.exited == TRUE, FALSE);
One way around it would be to check in connect_delayed if a
delayed_unref idle is queued, but that does not sound very nice.
Open to any suggestions :) (maybe we should not be in the
STATE_SWITCHING state when about to exit the coroutine?)
Christophe
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/spice-devel/attachments/20150129/36ac7d33/attachment.sig>
More information about the Spice-devel
mailing list