Threading: PyQt crashes with "unknown request in queue while dequeuing" Threading: PyQt crashes with "unknown request in queue while dequeuing" multithreading multithreading

Threading: PyQt crashes with "unknown request in queue while dequeuing"


Wow, this was obscure.

The X11 windowing functions are apparently not threadsafe unless explicitly set to be so, and for whatever reason PyQt doesn't automatically set them to be. This can be corrected by adding the following before the QApplication constructor:

QtCore.QCoreApplication.setAttribute(QtCore.Qt.AA_X11InitThreads)

See the documentation on QApplicationAttributes.