Re: [Vala] bug in IOChannel.read_line and add_watch



On Sun, 2014-02-02 at 14:10 +0100, rastersoft wrote:
Hi all:


Hi,

I found a bug in IOChannel.read_line: when the line to read ends in \r 
and there are no more characters after it, the iochannel can't read more 
chars, nor send more IN DATA AVAILABLE events from an add_watch. In 
fact, it seems to lock the gtk main loop.

I attach a code that triggers this bug: it creates a pipe, links it to 
an IOChannel, and uses a timer to send several strings through it, one 
each second. It also monitors the IOChannel with add_watch to print the 
data received.

The sentences sent are:

First string\n
Second string\nSecond string b\n
Third string\nThird string b\n\rThird string c\n
Fourth string\nFourth string b\n\r
Fifth string\n

The first, second and third sentences are sent and received fine, even 
with the third having a "\r" in the middle. But the fourth, that ends in 
a "\r", blocks the IOChannel, and the fifth string is never received, 
neither sent (the timer is never triggered after the fourth string).

Thank you very much for finding it out. IOChannel is implemented by glib
so probably they'll have more knowledge to find out what's wrong. Also
both Vala and GLib are using GNOME Bugzilla[1] to track the bugs so it
might be good to post it there (while ML have archives they are not as
searchable as Bugzilla and the latter allows to track bugs easier).

Best regards

PS. You might want to also look on GIO which have nicer interface for
Vala and IIRC more features and flexibility.

[1] https://bugzilla.gnome.org/

Attachment: signature.asc
Description: This is a digitally signed message part



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