avoid leaking DebugProcess on debug session end (with the tab still opened) pt.2

This commit is contained in:
Egor.Ushakov
2017-04-19 11:39:37 +03:00
parent c24f0b7d65
commit 6fd11e168b
2 changed files with 10 additions and 4 deletions
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2016 JetBrains s.r.o.
* Copyright 2000-2017 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -403,8 +403,10 @@ public class DebuggerSession implements AbstractDebuggerSession {
public void dispose() {
getProcess().dispose();
Disposer.dispose(myUpdateAlarm);
DebuggerInvocationUtil.swingInvokeLater(getProject(),
() -> getContextManager().setState(SESSION_EMPTY_CONTEXT, State.DISPOSED, Event.DISPOSE, null));
DebuggerInvocationUtil.swingInvokeLater(getProject(), () -> {
myContextManager.setState(SESSION_EMPTY_CONTEXT, State.DISPOSED, Event.DISPOSE, null);
myContextManager.dispose();
});
}
// ManagerCommands
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2015 JetBrains s.r.o.
* Copyright 2000-2017 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -46,4 +46,8 @@ public abstract class DebuggerStateManager {
protected void fireStateChanged(@NotNull DebuggerContextImpl newContext, DebuggerSession.Event event) {
myEventDispatcher.getMulticaster().changeEvent(newContext, event);
}
void dispose() {
myEventDispatcher.getListeners().clear();
}
}