[Qt-interest] Segment fault when updating OpenGL QGLWidget from thread ?
Samuel Rødal
sroedal at trolltech.com
Wed Jul 1 14:40:17 CEST 2009
Ed Sutton wrote:
> 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.
>
> 3 – The segment fault appears to be triggered when calling
> glClearColor(),before it gets to the end and calls QWidget::update()
>
> 4 – The segment fault occurs after I select a new video channel in my
> GUI and the changedChannel slot handler has been called.
>
>
>
> My figure I need a mutex in my frame handler. However, according to my
> debug print statements the main window’s changedChannel slot handler
> appears to have already completed before the segment fault occurs. I am
> a Qt / Linux newbie and realize I may be doing this all wrong.
>
>
>
> Thanks in advance for sharing your experience and any tips or direction.
>
>
>
> -Ed
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.
--
Samuel
More information about the Qt-interest-old
mailing list