[mythtv] [mythtv-commits] Ticket #1272: preview or lcd qsocket related segfault

Jim Westfall jwestfall at surrealistic.net
Fri Mar 31 23:06:18 UTC 2006


Isaac Richards <ijr at case.edu> wrote [03.31.06]:
> On Friday 31 March 2006 17:04, Jim Westfall wrote:
> > Looking at it while bored at work I think the following code is the
> > trigger in lcddevice.cpp.
> >
> > os << someText << "\n" << flush;
> >
> > There is a race between QSocket::flush() via a QSocketNotifier event and
> > this forced flush().
> >
> > I think the easy fix it to change
> >
> > QTextStream os(socket);
> >
> > to
> >
> > QTextStream os(socket->socketDevice());
> >
> > so QTextStream is directly writing to the QSocketDevice and bypassing the
> > thread-unsafe QSocket buffering.
> 
> I've seen issues (random crashing) before when just using the QSocket's 
> QSocketDevice.  Only way to really fix it is not to use QSocket.
> 

yeah its all a pain in the arse.  

There is also the issue of directly using the QSocketDevice of QSocket to 
read/write.  It bypasses QSockets error handling of the functions, which 
includes emitting connectionClosed when the socket dies mid read/write.  
This is something that effects aborted FileTransfer sockets on the 
backend and leaves lost FileTransfer objects in the fileTransferList.

I have been thinking about trying to write a MythSocket class that is 
thread safe.

jim  


More information about the mythtv-dev mailing list