call dispose() on session that failed to start

This commit is contained in:
Eugene Zhuravlev
2012-03-29 21:11:31 +02:00
parent 6ea7222b14
commit 411c7ab318
2 changed files with 13 additions and 12 deletions
@@ -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) {
@@ -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);
}