From 411c7ab318e6c2baec1c618dd0901d4239db2cb8 Mon Sep 17 00:00:00 2001 From: Eugene Zhuravlev Date: Thu, 29 Mar 2012 21:09:23 +0200 Subject: [PATCH] call dispose() on session that failed to start --- .../debugger/engine/DebugProcessImpl.java | 2 +- .../debugger/ui/DebuggerPanelsManager.java | 23 ++++++++++--------- 2 files changed, 13 insertions(+), 12 deletions(-) diff --git a/java/debugger/impl/src/com/intellij/debugger/engine/DebugProcessImpl.java b/java/debugger/impl/src/com/intellij/debugger/engine/DebugProcessImpl.java index 39f4c48872e1..68783d708616 100644 --- a/java/debugger/impl/src/com/intellij/debugger/engine/DebugProcessImpl.java +++ b/java/debugger/impl/src/com/intellij/debugger/engine/DebugProcessImpl.java @@ -1755,7 +1755,7 @@ public abstract class DebugProcessImpl implements DebugProcess { fail(); if (myExecutionResult != null || !connectorIsReady.get()) { // propagate exception only in case we succeded to obtain execution result, - // otherwise it the error is induced by the fact that there is nothing to debug, and there is no need to show + // otherwise if the error is induced by the fact that there is nothing to debug, and there is no need to show // this problem to the user final RunProfile runProfile = state.getRunnerSettings().getRunProfile(); if (runProfile != null) { diff --git a/java/debugger/impl/src/com/intellij/debugger/ui/DebuggerPanelsManager.java b/java/debugger/impl/src/com/intellij/debugger/ui/DebuggerPanelsManager.java index 99b914cceb73..041fb2876416 100644 --- a/java/debugger/impl/src/com/intellij/debugger/ui/DebuggerPanelsManager.java +++ b/java/debugger/impl/src/com/intellij/debugger/ui/DebuggerPanelsManager.java @@ -96,28 +96,29 @@ public class DebuggerPanelsManager implements ProjectComponent { } @Nullable - public - RunContentDescriptor attachVirtualMachine(Executor executor, - ProgramRunner runner, - ExecutionEnvironment environment, - RunProfileState state, - RunContentDescriptor reuseContent, - RemoteConnection remoteConnection, - boolean pollConnection) throws ExecutionException { + public RunContentDescriptor attachVirtualMachine(Executor executor, + ProgramRunner runner, + ExecutionEnvironment environment, + RunProfileState state, + RunContentDescriptor reuseContent, + RemoteConnection remoteConnection, + boolean pollConnection) throws ExecutionException { - final DebuggerSession debuggerSession = - DebuggerManagerEx.getInstanceEx(myProject).attachVirtualMachine(executor, runner, (ModuleRunProfile) environment.getRunProfile(), state, remoteConnection, pollConnection); + final DebuggerSession debuggerSession = DebuggerManagerEx.getInstanceEx(myProject).attachVirtualMachine( + executor, runner, (ModuleRunProfile) environment.getRunProfile(), state, remoteConnection, pollConnection + ); if (debuggerSession == null) { return null; } final DebugProcessImpl debugProcess = debuggerSession.getProcess(); if (debugProcess.isDetached() || debugProcess.isDetaching()) { + debuggerSession.dispose(); return null; } if (state instanceof RemoteState) { // optimization: that way BatchEvaluator will not try to lookup the class file in remote VM - // which is an expensive oparation when executed first time + // which is an expensive operation when executed first time debugProcess.putUserData(BatchEvaluator.REMOTE_SESSION_KEY, Boolean.TRUE); }