From a8c94266b227ac72954c6324af30f55b72935bbe Mon Sep 17 00:00:00 2001 From: Eugene Zhuravlev Date: Mon, 22 Sep 2008 19:18:10 +0400 Subject: [PATCH] reverted changes with "stop" --- .../debugger/impl/DebuggerManagerImpl.java | 39 +++++----------------- 1 file changed, 9 insertions(+), 30 deletions(-) diff --git a/debugger/impl/com/intellij/debugger/impl/DebuggerManagerImpl.java b/debugger/impl/com/intellij/debugger/impl/DebuggerManagerImpl.java index c5a21635eb..bbb0b2851f 100644 --- a/debugger/impl/com/intellij/debugger/impl/DebuggerManagerImpl.java +++ b/debugger/impl/com/intellij/debugger/impl/DebuggerManagerImpl.java @@ -42,7 +42,6 @@ import org.jetbrains.annotations.NonNls; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; -import javax.swing.*; import java.io.File; import java.util.ArrayList; import java.util.Collection; @@ -209,38 +208,18 @@ public class DebuggerManagerImpl extends DebuggerManagerEx { // so we shouldn't add the listener to avoid calling stop() twice processHandler.addProcessListener(new ProcessAdapter() { public void processWillTerminate(ProcessEvent event, boolean willBeDestroyed) { - if (!willBeDestroyed || ApplicationManager.getApplication().isUnitTestMode()) { - final DebugProcessImpl debugProcess = getDebugProcess(event.getProcessHandler()); - if (debugProcess != null) { - // if current thread is a "debugger manager thread", stop will execute synchronously - debugProcess.stop(willBeDestroyed); - - // wait at most 10 seconds: the problem is that debugProcess.stop() can hang if there are troubles in the debuggee - // if processWillTerminate() is called from AWT thread debugProcess.waitFor() will block it and the whole app will hang - if (!DebuggerManagerThreadImpl.isManagerThread()) { - debugProcess.waitFor(10000); - } - } - } - else { - final DebuggerSession session = getDebugSession(event.getProcessHandler()); - if (session != null) { - // on OSX & Linux the process should be resumed before calling destroyProcess(), otherwise the process will stay in memory - if (ApplicationManager.getApplication().isDispatchThread()) { - session.resume(); - } - else { - //noinspection SSBasedInspection - SwingUtilities.invokeLater(new Runnable() { - public void run() { - session.resume(); - } - }); - } + final DebugProcessImpl debugProcess = getDebugProcess(event.getProcessHandler()); + if (debugProcess != null) { + // if current thread is a "debugger manager thread", stop will execute synchronously + debugProcess.stop(willBeDestroyed); + + // wait at most 10 seconds: the problem is that debugProcess.stop() can hang if there are troubles in the debuggee + // if processWillTerminate() is called from AWT thread debugProcess.waitFor() will block it and the whole app will hang + if (!DebuggerManagerThreadImpl.isManagerThread()) { + debugProcess.waitFor(10000); } } } - }); } myDispatcher.getMulticaster().sessionCreated(session); -- 2.11.4.GIT