IDEA-63378 - fixed leaking contexts

This commit is contained in:
Egor.Ushakov
2015-09-09 15:45:47 +03:00
parent 73da563592
commit ebdc625624
2 changed files with 8 additions and 1 deletions
@@ -114,6 +114,13 @@ public class SuspendManagerImpl implements SuspendManager {
return suspendContext;
}
public SuspendContextImpl createDummyContext(int suspendPolicy) {
return new SuspendContextImpl(myDebugProcess, suspendPolicy, 0, null) {
@Override
protected void resumeImpl() {}
};
}
@Override
public SuspendContextImpl pushSuspendContext(final EventSet set) {
SuspendContextImpl suspendContext = new SuspendContextImpl(myDebugProcess, set.suspendPolicy(), set.size(), set) {
@@ -656,7 +656,7 @@ public class DebuggerSession implements AbstractDebuggerSession {
if (suspendContext != null
&& suspendContext.getSuspendPolicy() == EventRequest.SUSPEND_EVENT_THREAD
&& isSteppingThrough(suspendContext.getThread())) {
context = suspendManager.pushSuspendContext(suspendContext.getSuspendPolicy(), 0);
context = ((SuspendManagerImpl)suspendManager).createDummyContext(suspendContext.getSuspendPolicy());
context.setThread(suspendContext.getThread().getThreadReference());
}
final SuspendContextImpl currentContext = context;