Hi,
for data communication between 2 Bluetooth devices I have created IO
channels on the corresponding sockets. This works well the most time.
However, sometimes (I could not determine the exact occurrence yet)
flushing the channel with g_io_channel_flush() fails in that it raises
an assertion error. The failure happens in the line
g_assert (this_time > 0);
in the function below (from giochannel.c)
------ snip -------
GIOStatus
g_io_channel_flush (GIOChannel *channel, GError **error)
{
GIOStatus status;
gsize this_time = 1, bytes_written = 0;
g_return_val_if_fail (channel != NULL, G_IO_STATUS_ERROR);
g_return_val_if_fail ((error == NULL) || (*error == NULL),
G_IO_STATUS_ERROR);
if (channel->write_buf == NULL || channel->write_buf->len == 0)
return G_IO_STATUS_NORMAL;
do
{
g_assert (this_time > 0); /// THIS ASSERTION FAILS ///
status = channel->funcs->io_write(channel,
channel->write_buf->str + bytes_written,
channel->write_buf->len - bytes_written,
&this_time, error);
bytes_written += this_time;
}
while ((bytes_written < channel->write_buf->len)
&& (status == G_IO_STATUS_NORMAL));
g_string_erase (channel->write_buf, 0, bytes_written);
return status;
}
------- snip --------
Afaik. assertions are used to detect bugs .. why is it considered as a
bug if channel->funcs->io_write() writes no data (this_time == 0)? And
who is responsible for that assertion failure?
Thanks for some advice,
Christian
_______________________________________________
gtk-list mailing list
[email protected]
http://mail.gnome.org/mailman/listinfo/gtk-list