Debugger: Fixed infrequent deadlock when switching games while debugger window is opened
This commit is contained in:
parent
cfad3c1f91
commit
9abaeaf8d8
2 changed files with 10 additions and 2 deletions
|
@ -163,6 +163,8 @@ bool Console::Initialize(VirtualFile &romFile, VirtualFile &patchFile)
|
|||
_initialized = true;
|
||||
|
||||
if(_debugger) {
|
||||
//Reset debugger if it was running before
|
||||
auto lock = _debuggerLock.AcquireSafe();
|
||||
StopDebugger();
|
||||
GetDebugger();
|
||||
}
|
||||
|
@ -660,9 +662,14 @@ std::shared_ptr<Debugger> Console::GetDebugger(bool autoStart)
|
|||
{
|
||||
shared_ptr<Debugger> debugger = _debugger;
|
||||
if(!debugger && autoStart) {
|
||||
//Lock to make sure we don't try to start debuggers in 2 separate threads at once
|
||||
auto lock = _debuggerLock.AcquireSafe();
|
||||
debugger = _debugger;
|
||||
if(!debugger) {
|
||||
debugger.reset(new Debugger(Console::Instance, _cpu, _ppu, _apu, _memoryManager, _mapper));
|
||||
_debugger = debugger;
|
||||
}
|
||||
}
|
||||
return debugger;
|
||||
}
|
||||
|
||||
|
|
|
@ -31,6 +31,7 @@ class Console
|
|||
SimpleLock _pauseLock;
|
||||
SimpleLock _runLock;
|
||||
SimpleLock _stopLock;
|
||||
SimpleLock _debuggerLock;
|
||||
|
||||
shared_ptr<RewindManager> _rewindManager;
|
||||
shared_ptr<CPU> _cpu;
|
||||
|
|
Loading…
Add table
Reference in a new issue