fix: detach debugger after close
This commit is contained in:
parent
7cb267b0d9
commit
d2897a2df7
@ -36,6 +36,10 @@ public class DebugContext {
|
||||
this.debugger = debugger;
|
||||
return true;
|
||||
}
|
||||
public boolean detachDebugger(DebugHandler debugger) {
|
||||
if (this.debugger != debugger) return false;
|
||||
return detachDebugger();
|
||||
}
|
||||
public boolean detachDebugger() {
|
||||
this.debugger = null;
|
||||
return true;
|
||||
|
@ -205,6 +205,7 @@ public class SimpleDebugger implements Debugger {
|
||||
|
||||
private ObjectValue emptyObject = new ObjectValue();
|
||||
|
||||
private WeakHashMap<DebugContext, DebugContext> contexts = new WeakHashMap<>();
|
||||
private WeakHashMap<FunctionBody, FunctionMap> mappings = new WeakHashMap<>();
|
||||
private WeakHashMap<FunctionBody, HashMap<Location, Breakpoint>> bpLocs = new WeakHashMap<>();
|
||||
|
||||
@ -642,11 +643,10 @@ public class SimpleDebugger implements Debugger {
|
||||
execptionType = CatchType.NONE;
|
||||
state = State.RESUMED;
|
||||
|
||||
// idToBptCand.clear();
|
||||
mappings.clear();
|
||||
bpLocs.clear();
|
||||
|
||||
idToBreakpoint.clear();
|
||||
// locToBreakpoint.clear();
|
||||
// tmpBreakpts.clear();
|
||||
|
||||
filenameToId.clear();
|
||||
idToSource.clear();
|
||||
@ -664,6 +664,9 @@ public class SimpleDebugger implements Debugger {
|
||||
stepOutFrame = currFrame = null;
|
||||
stepOutPtr = 0;
|
||||
|
||||
for (var ctx : contexts.keySet()) ctx.detachDebugger(this);
|
||||
contexts.clear();
|
||||
|
||||
updateNotifier.next();
|
||||
}
|
||||
|
||||
@ -1041,6 +1044,7 @@ public class SimpleDebugger implements Debugger {
|
||||
|
||||
public SimpleDebugger attach(DebugContext ctx) {
|
||||
ctx.attachDebugger(this);
|
||||
contexts.put(ctx, ctx);
|
||||
return this;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user