Debugger can get detached during a callback, clean up appropriately
Jeffrey Pfau jeffrey@endrift.com
Sun, 02 Feb 2014 03:57:41 -0800
1 files changed,
3 insertions(+),
2 deletions(-)
jump to
M
src/gba/gba-thread.c
→
src/gba/gba-thread.c
@@ -108,8 +108,9 @@ _changeState(threadContext, THREAD_RUNNING, 1);
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 {