Re: Anjuta2 -- problem importing Anjuta project files



On Wed, 2002-10-09 at 12:37, John Palmieri wrote:
> Hmm, I sort of fixed the problem but had some wierd debugging output
> that did not match the GTK documentation. In the function read_output:
> 
> if (condition == G_IO_IN || condition == G_IO_PRI )
> 
> I added || TRUE to the statement to see what would happen if I executed
> the code block without reading a condition of G_IO_IN or G_IO_PRI.  It
> loaded my project flawlessly every time.  To see what condition it was
> passing in I did a printf("CON: %i", condition); and also added a printf
> for every enum in GIOCondition.  Here was the wierd output:
> 
> CON: 17
> G_IO_IN 1, G_IO_OUT 4, G_IO_PRI 2, G_IO_ERR 8, G_IO_HUP 16, G_IO_NVAL 32
> 
> CON: 16
> G_IO_IN 1, G_IO_OUT 4, G_IO_PRI 2, G_IO_ERR 8, G_IO_HUP 16, G_IO_NVAL 32
> 
> 
> If you notice there is no condition 17 in GIOCondition.  This could be
> an error in GLib.  

Well, actually (as I've just learned :-) a GIOCondition value is a
bitwise combination of any of those values.  I checked GLib sources, and
the condition you get at an IO handler is the buffer condition (which
can be G_IO_IN and/or G_IO_OUT) or'ed with the poll status from the file
descriptor.  In the case when you get 17 as the value, it probably means
the buffer has data to be read, and the other side has already closed
the pipe.

So, probably the right solution would be to replace:

if (condition == G_IO_IN || condition == G_IO_PRI )

with

if (condition & (G_IO_IN | G_IO_PRI))

Could you please check if this solves the problem?  I still can't
reproduce the bug here, no matter how small the project I open :-)

Regards,
Gustavo





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]