From 52e8a43dc0e023e7be1b5d652aecdc65ae127da9 Mon Sep 17 00:00:00 2001 From: "Egor.Ushakov" Date: Fri, 13 Mar 2015 17:14:55 +0300 Subject: [PATCH] IDEA-137526 Remote debugging not working - fixed no notification in some cases --- .../debugger/engine/DebugProcessImpl.java | 26 +++++++++---------- 1 file changed, 12 insertions(+), 14 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 20f0cb122cad..24224f93c530 100644 --- a/java/debugger/impl/src/com/intellij/debugger/engine/DebugProcessImpl.java +++ b/java/debugger/impl/src/com/intellij/debugger/engine/DebugProcessImpl.java @@ -26,10 +26,7 @@ import com.intellij.debugger.engine.events.SuspendContextCommandImpl; import com.intellij.debugger.engine.jdi.ThreadReferenceProxy; import com.intellij.debugger.engine.requests.MethodReturnValueWatcher; import com.intellij.debugger.engine.requests.RequestManagerImpl; -import com.intellij.debugger.impl.DebuggerContextImpl; -import com.intellij.debugger.impl.DebuggerSession; -import com.intellij.debugger.impl.DebuggerUtilsEx; -import com.intellij.debugger.impl.PrioritizedTask; +import com.intellij.debugger.impl.*; import com.intellij.debugger.jdi.StackFrameProxyImpl; import com.intellij.debugger.jdi.ThreadReferenceProxyImpl; import com.intellij.debugger.jdi.VirtualMachineProxyImpl; @@ -89,6 +86,7 @@ import javax.swing.*; import java.io.IOException; import java.net.UnknownHostException; import java.util.*; +import java.util.concurrent.atomic.AtomicBoolean; import java.util.concurrent.atomic.AtomicInteger; public abstract class DebugProcessImpl extends UserDataHolderBase implements DebugProcess { @@ -1852,7 +1850,7 @@ public abstract class DebugProcessImpl extends UserDataHolderBase implements Deb final Semaphore semaphore = new Semaphore(); semaphore.down(); - final Ref connectorIsReady = Ref.create(false); + final AtomicBoolean connectorIsReady = new AtomicBoolean(false); myDebugProcessDispatcher.addListener(new DebugProcessAdapter() { @Override public void connectorIsReady() { @@ -1890,17 +1888,17 @@ public abstract class DebugProcessImpl extends UserDataHolderBase implements Deb } else { fail(); - if (myExecutionResult != null || !connectorIsReady.get()) { - // propagate exception only in case we succeeded to obtain execution result, - // 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 - SwingUtilities.invokeLater(new Runnable() { - @Override - public void run() { + DebuggerInvocationUtil.swingInvokeLater(myProject, new Runnable() { + @Override + public void run() { + // propagate exception only in case we succeeded to obtain execution result, + // 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 + if (myExecutionResult != null || !connectorIsReady.get()) { ExecutionUtil.handleExecutionError(myProject, ToolWindowId.DEBUG, sessionName, e); } - }); - } + } + }); break; } }