[PyQt] Errors while rendering to multiple QGLWidgets in a multi-threaded app

David Boddie david at boddie.org.uk
Mon Nov 7 23:45:23 GMT 2011


On Sat, 5 Nov 2011 17:57:04 -0700, Michael Broxton wrote:

> I wanted to send another quick request for help in case any PyQt devs or
> users can help me with the QGLWidget multi-threaded rendering bug I posted
> about below... I've done a little more testing this week and found that
> this issue occurs on Linux as well, so the problem does appear to be truly
> cross-platform (confirmed on Mac/Win/Linux).

The code you posted earlier crashed for me using both the Python threading
module and QThread. The OpenGL context also caused the GUI to block, so
perhaps that's a clue you can follow.

> Once again, I have a C++ 
> implementation of the test program in pure Qt that does not crash when
> rendering multiple QGLWidgets from multiple threads, so I don't think that
> my approach is fundamentally flawed.  However, the PyQt test program
> (https://gist.github.com/1318290) does crash shortly after multiple render
> threads are up and running.  Any clues as to why this is happening in PyQt
> but not pure Qt would be greatly appreciated.

I wonder if there's a race condition somewhere that lets you get away with
it in C++ but not in Python. In any case, I'd be concerned that there's some
interaction with the main thread that you're not aware of.

David


More information about the PyQt mailing list