g_io_channel_read_chars() loop



	So, I did an update yesterday.  Lo and behold, my application
starts looping.  Unfortunately, it seems pretty random, but not at all
rare.  I am merely doing a g_io_add_watch() on a subprocess file
descriptor.  In my GPollFunc, I call g_io_channel_read_chars().
Sometimes the run works just fine.  Others, I get a loop here:

   1676       do
   1677         {
   1678           prevchar = nextchar;
   1679           nextchar = g_utf8_next_char (nextchar);
   1680         }
   1681       while (nextchar < channel->encoded_read_buf->str + got_bytes);

	Much gdbing later, I discover that got_bytes == 17,
channel->encoded_read_buf->len == 17, but channel->encoded_read_buf->str
== "\0garbage".  So g_utf8_next_char() will never walk to the end of the
string, and the while expression will never return false.
	I've looked at the code extensively, and at the changes from the
last checkin, and I don't see anything out of the ordinary.  It looks
clean to me.  But I'm still getting this behavior.  It happens on both
Linux 2.2 and 2.4, though it triggers more often on 2.4.

Joel

-- 

"Gone to plant a weeping willow
 On the bank's green edge it will roll, roll, roll.
 Sing a lulaby beside the waters.
 Lovers come and go, the river roll, roll, rolls."

			http://www.jlbec.org/
			jlbec evilplan org




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