Seg fault reading data from IOChannel
- From: "Víctor M. Palacio Tárrega" <victorpalacio adtelecom es>
- To: gtkmm-list gnome org
- Subject: Seg fault reading data from IOChannel
- Date: Tue, 03 Feb 2009 09:19:12 +0100
Constructing a graphical server app, I'm using Glib::IOChannel in order
to have a callback when client data is ready to read on socket.
The problem is that sometimes I obtain a seg fault when calling function
IOChannel::read(char* buff, gsize len,gsize& readed). Gdb debugging says
that it's the seg violation is from IOChannel::read() function, not in
data postprocessing from my app code.
I workarounded it using ::read(...) instead (that sometimes also fails,
but do not seg faulting), and not processing data when reads .
Any ideas about it?
It looks like a bug in IOChannel for you, or I'm doing something really
I'm doing collateral damage with my workaround, and you think it will
explode in my face later?
int NetworkCommandManager::read_data(char* data, int len)
std::cerr << "Cannot read more than 256 bytes" << std::endl;
std::cout<< "to read "<< len << " bytes" << std::endl;
n = ::read(read_fd,data,len); //workaround
//ioc_net->read(data,(gsize)len,n); //seg faulting call
std::cout<< "readed "<< n << " bytes" << std::endl;
if (n == len)
//*Víctor M. Palacio Tárrega*//
] [Thread Prev