Use m_DeferredInit to guard waiting in python calls that need reflector

This commit is contained in:
baldurk committed 2026-10-26 13:14:10 +00:00
1 parent 0384f09365
commit 36a95ccb0c
1 file changed
+8 -5
@@ -1767,14 +1767,16 @@ QWidget *PythonContext::QWidgetFromPy(PyObject *widget)
void PythonContext::reflectSource(QString src)
{
if(!m_Reflector)
if(m_DeferredInit == 0)
{
for(int i = 0; i < 50 && m_DeferredInit == 0; i++)
QThread::msleep(20);
m_DeferredInit = 1;
if(!m_Reflector)
{
m_DeferredInit = 1;
return;
}
}
PyGILState_STATE gil = PyGILState_Ensure();
@@ -1799,15 +1801,16 @@ void PythonContext::reflectSource(QString src)
void PythonContext::makeHelpContext()
{
// expand out members of renderdoc and qrenderdoc using the stubs
if(!m_StubRD || !m_StubQRD)
if(m_DeferredInit == 0)
{
for(int i = 0; i < 50 && m_DeferredInit == 0; i++)
QThread::msleep(20);
m_DeferredInit = 1;
if(!m_StubRD || !m_StubQRD)
{
m_DeferredInit = 1;
return;
}
}
PyGILState_STATE gil = PyGILState_Ensure();