[Qt-interest] Segment fault when updating OpenGL QGLWidget from thread ?

Ed Sutton ESutton at fescorp.com
Wed Jul 1 15:04:46 CEST 2009


Hi Samuel,

Thank you for your reply.

> > How can I synchronize thread access to my GUI window?
> > 1 - I have a thread receiving video data over the network.
> >
> > 2 - When a frame is complete it makes a callback to my QGLWidget derived
> > class's frame handler  - a static method that gets passed the instance
> > of the class. 


> You shouldn't necessarily have to use a QMutex, sending the image data
> for the frame over as a QVector / QImage using signals and slots might
> be sufficient.

It sounds like signals and slots is not only a call-back mechanism, it also synchronizes thread access to the GUI.  Is this correct?

How would I implement this?
 
1 - Derive an object from QObject 
2 - Connect derived QObject signal to the GUI's slot
3 - Make QObject receive the callback from my worker thread and emit the signal and synchronization will be handled automatically?
 
Thanks again,

-Ed






More information about the Qt-interest-old mailing list