diff --git a/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/service/tracemgr/DebuggerTraceManagerServicePlugin.java b/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/service/tracemgr/DebuggerTraceManagerServicePlugin.java index 821cd14e34..2319d77722 100644 --- a/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/service/tracemgr/DebuggerTraceManagerServicePlugin.java +++ b/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/service/tracemgr/DebuggerTraceManagerServicePlugin.java @@ -984,16 +984,20 @@ public class DebuggerTraceManagerServicePlugin extends Plugin navigationHistoryService.clear(trace.getProgramView()); } synchronized (listenersByTrace) { - trace.release(this); lastCoordsByTrace.remove(trace); trace.removeListener(listenersByTrace.remove(trace)); //Msg.debug(this, "Remaining Consumers of " + trace + ": " + trace.getConsumerList()); } - if (current.getTrace() == trace) { - activate(DebuggerCoordinates.NOWHERE, ActivationCause.ACTIVATE_DEFAULT); + try { + if (current.getTrace() == trace) { + activate(DebuggerCoordinates.NOWHERE, ActivationCause.ACTIVATE_DEFAULT); + } + else { + contextChanged(); + } } - else { - contextChanged(); + finally { + trace.release(this); } } diff --git a/Ghidra/Debug/Debugger/src/test/java/ghidra/app/plugin/core/debug/gui/AbstractGhidraHeadedDebuggerTest.java b/Ghidra/Debug/Debugger/src/test/java/ghidra/app/plugin/core/debug/gui/AbstractGhidraHeadedDebuggerTest.java index c4ca0f3b7a..8e662d2a29 100644 --- a/Ghidra/Debug/Debugger/src/test/java/ghidra/app/plugin/core/debug/gui/AbstractGhidraHeadedDebuggerTest.java +++ b/Ghidra/Debug/Debugger/src/test/java/ghidra/app/plugin/core/debug/gui/AbstractGhidraHeadedDebuggerTest.java @@ -655,7 +655,7 @@ public abstract class AbstractGhidraHeadedDebuggerTest if (tb != null) { if (traceManager != null && traceManager.getOpenTraces().contains(tb.trace)) { - traceManager.closeTrace(tb.trace); + traceManager.closeTraceNoConfirm(tb.trace); } tb.close(); }