Debugger can get detached during a callback, clean up appropriately

This commit is contained in:
Jeffrey Pfau 2014-02-02 03:57:41 -08:00
parent 243cf2236b
commit 56c51181e1
1 changed files with 3 additions and 2 deletions

View File

@ -108,8 +108,9 @@ static THREAD_ENTRY _GBAThreadRun(void* context) {
while (threadContext->state < THREAD_EXITING) {
if (threadContext->debugger) {
ARMDebuggerRun(threadContext->debugger);
if (threadContext->debugger->state == DEBUGGER_SHUTDOWN) {
struct ARMDebugger* debugger = threadContext->debugger;
ARMDebuggerRun(debugger);
if (debugger->state == DEBUGGER_SHUTDOWN) {
_changeState(threadContext, THREAD_EXITING, 0);
}
} else {