Fix rare re-entrancy issue with CCryEditApp::IdleProcessing (#1134)

This issue manifested in a crash in rare circumstances when the Editor lost and gained focus while a modal dialog was active. After investigation, it was discovered that native event processing can lead to IdleProcessing being called again from the main thread while idle processing is still happening. As this is unintentional and generally undesirable, we now guard against this within the IdleProcessing method.
This commit is contained in:
Nicholas Van Sickle
2021-06-03 20:08:51 -07:00
committed by GitHub
parent fe98c34f50
commit f39460e617
2 changed files with 10 additions and 0 deletions
+8
View File
@@ -2281,6 +2281,14 @@ int CCryEditApp::IdleProcessing(bool bBackgroundUpdate)
return 0;
}
// Ensure we don't get called re-entrantly
// This can occur when a nested Qt event loop fires (e.g. by way of a modal dialog calling exec)
if (m_idleProcessingRunning)
{
return 0;
}
QScopedValueRollback<bool> guard(m_idleProcessingRunning, true);
////////////////////////////////////////////////////////////////////////
// Call the update function of the engine
////////////////////////////////////////////////////////////////////////