[Spice-devel] [PATCH spice-gtk] windows: initialize co->ret to not randomly release fiber

Christophe Fergeau cfergeau at redhat.com
Thu Dec 15 01:21:50 PST 2011


On Thu, Dec 15, 2011 at 10:16:48AM +0100, Marc-André Lureau wrote:
> Hi
> 
> On Thu, Dec 15, 2011 at 10:13 AM, Christophe Fergeau <cfergeau at redhat.com>wrote:
> 
> > Hey,
> >
> > When is it triggered exactly? On reconnect? The coroutine structure is
> > stored in SpiceChannelPrivate which means it's initially 0'ed out, and this
> > should be 0 when coroutine_init is first called. If this co->ret = 0; is
> > there to handle subsequent calls to coroutine_init, it might be better to
> > memset the whole struct coroutine on disconnect (or whatever place is
> > appropriate), or to do 0 out the whole structure first thing in all the
> > coroutine implementations.
> >
> > Dunno if that makes sense or if I missed something though :)
> >
> 
> Correct, it happens on reconnect, reusing the same channel.
> 
> I prefer initialization of this value where the fiber is initialized. But
> your proposed solutions would work too.

I'm fine with doing this in _init, but having a memset() in all _init feels
safer, otherwise we might have to fix similar bugs (something in the
coroutine implementation expecting fields in struct coroutine to be 0) in
the future.

ACK on whatever you decide to do :)

Christophe
-------------- 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/20111215/a9a93b46/attachment.pgp>


More information about the Spice-devel mailing list