GLThread lock in PythonExtension::paint

Linux/X11, proprietary NVidia driver, ENABLE_THREADEDGL=ON, ENABLE_PYTHON=ON

GLThread is locked on first call of PythonExtension::paint() in GLWidget::render().

I’ve found that commenting the line

PythonThread pt;

in PythonExtension::paint() fixes this problem. But this solution seems inappropriate for me,
because it can break proper handling of GIL in Python-related code. PythonThread calls
PyGILState_Ensure() in its constructor and PyGILState_Release in destructor.

Does anybody have an idea why PyGILState_Ensure() causes deadlock here?


Regards,
Konstantin

16.02.2011, 16:39, “Konstantin Tokarev” annulen@yandex.ru:

Linux/X11, proprietary NVidia driver, ENABLE_THREADEDGL=ON, ENABLE_PYTHON=ON

GLThread is locked on first call of PythonExtension::paint() in GLWidget::render().

I’ve found that commenting the line

PythonThread pt;

in PythonExtension::paint() fixes this problem. But this solution seems inappropriate for me,
because it can break proper handling of GIL in Python-related code. PythonThread calls
PyGILState_Ensure() in its constructor and PyGILState_Release in destructor.

Does anybody have an idea why PyGILState_Ensure() causes deadlock here?

I’ve found a solution: making PythonExtension::paint() a slot and using QMetaObject::invokeMethod
allows to avoid thread confusion


Regards,
Konstantin