Bug fix for stack overflow error that can occur when calling QCoreApplication::processEvents() and not guarding against recursion on calling parent function.

This commit is contained in:
mjbudd77 2021-12-29 22:23:00 -05:00
parent 199a3d8d72
commit 04b8d8a789
1 changed files with 18 additions and 0 deletions

View File

@ -4285,9 +4285,18 @@ void consoleWin_t::transferVideoBuffer(void)
void consoleWin_t::emuFrameFinish(void)
{
static bool eventProcessingInProg = false;
if ( eventProcessingInProg )
{ // Prevent recursion as processEvents function can double back on us
return;
}
eventProcessingInProg = true;
// Process all events before attempting to render viewport
QCoreApplication::processEvents();
eventProcessingInProg = false;
// Update Input Devices
FCEUD_UpdateInput();
@ -4298,9 +4307,18 @@ void consoleWin_t::emuFrameFinish(void)
void consoleWin_t::updatePeriodic(void)
{
static bool eventProcessingInProg = false;
if ( eventProcessingInProg )
{ // Prevent recursion as processEvents function can double back on us
return;
}
eventProcessingInProg = true;
// Process all events before attempting to render viewport
QCoreApplication::processEvents();
eventProcessingInProg = false;
// Update Input Devices
FCEUD_UpdateInput();