[Vala] bug in IOChannel.read_line and add_watch



Hi all:

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).

--
Nos leemos
                         RASTER    (Linux user #228804)
raster rastersoft com              http://www.rastersoft.com

Attachment: test_iochannel.vala
Description: Text Data



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