Bug fix for emulation thread incorrectly accessing GUI widgets. All widget access must be done in GUI thread.

This commit is contained in:
mjbudd77 2021-08-03 23:44:50 -04:00
parent 50861ab903
commit e0bc4ab67b
1 changed files with 10 additions and 8 deletions

View File

@ -88,6 +88,7 @@ static ConsoleDebugger* dbgWin = NULL;
static void DeleteBreak(int sel); static void DeleteBreak(int sel);
static bool waitingAtBp = false; static bool waitingAtBp = false;
static bool bpDebugEnable = true; static bool bpDebugEnable = true;
static bool bpNotifyReq = false;
static int lastBpIdx = 0; static int lastBpIdx = 0;
static bool breakOnCycleOneShot = 0; static bool breakOnCycleOneShot = 0;
static bool breakOnInstrOneShot = 0; static bool breakOnInstrOneShot = 0;
@ -3939,6 +3940,14 @@ void ConsoleDebugger::updatePeriodic(void)
//printf("Update Periodic\n"); //printf("Update Periodic\n");
if ( bpNotifyReq )
{
fceuWrapperLock();
breakPointNotify( lastBpIdx );
fceuWrapperUnLock();
bpNotifyReq = false;
}
if ( windowUpdateReq ) if ( windowUpdateReq )
{ {
fceuWrapperLock(); fceuWrapperLock();
@ -4110,7 +4119,6 @@ void bpDebugSetEnable(bool val)
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
void FCEUD_DebugBreakpoint( int bpNum ) void FCEUD_DebugBreakpoint( int bpNum )
{ {
std::list <ConsoleDebugger*>::iterator it;
if ( !nes_shm->runEmulator || !bpDebugEnable ) if ( !nes_shm->runEmulator || !bpDebugEnable )
{ {
@ -4118,6 +4126,7 @@ void FCEUD_DebugBreakpoint( int bpNum )
} }
lastBpIdx = bpNum; lastBpIdx = bpNum;
waitingAtBp = true; waitingAtBp = true;
bpNotifyReq = true;
if (bpNum == BREAK_TYPE_CYCLES_EXCEED) if (bpNum == BREAK_TYPE_CYCLES_EXCEED)
{ {
@ -4160,11 +4169,6 @@ void FCEUD_DebugBreakpoint( int bpNum )
fceuWrapperUnLock(); fceuWrapperUnLock();
if ( dbgWin )
{
dbgWin->breakPointNotify( bpNum );
}
while ( nes_shm->runEmulator && bpDebugEnable && while ( nes_shm->runEmulator && bpDebugEnable &&
FCEUI_EmulationPaused() && !FCEUI_EmulationFrameStepped()) FCEUI_EmulationPaused() && !FCEUI_EmulationFrameStepped())
{ {
@ -4215,8 +4219,6 @@ bool debuggerWaitingAtBreakpoint(void)
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
void updateAllDebuggerWindows( void ) void updateAllDebuggerWindows( void )
{ {
std::list <ConsoleDebugger*>::iterator it;
if ( dbgWin ) if ( dbgWin )
{ {
dbgWin->queueUpdate(); dbgWin->queueUpdate();