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:
committed by
GitHub
parent
fe98c34f50
commit
f39460e617
@@ -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
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
|
||||
Reference in New Issue
Block a user