From d7e94bfb9824e5d7858d83ade0c4ec1fe123c029 Mon Sep 17 00:00:00 2001 From: "Egor.Ushakov" Date: Tue, 8 Jul 2014 15:53:07 +0400 Subject: [PATCH] do not hold read lock for too long, during remote debugging initBreakpoints may take long --- .../debugger/engine/DebugProcessEvents.java | 13 ++++--------- .../intellij/xdebugger/impl/XDebugSessionImpl.java | 8 +++++++- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/java/debugger/impl/src/com/intellij/debugger/engine/DebugProcessEvents.java b/java/debugger/impl/src/com/intellij/debugger/engine/DebugProcessEvents.java index 5c65a3944805..1db0ed60774e 100644 --- a/java/debugger/impl/src/com/intellij/debugger/engine/DebugProcessEvents.java +++ b/java/debugger/impl/src/com/intellij/debugger/engine/DebugProcessEvents.java @@ -322,15 +322,10 @@ public class DebugProcessEvents extends DebugProcessImpl { myDebugProcessDispatcher.getMulticaster().processAttached(this); // breakpoints should be initialized after all processAttached listeners work - ApplicationManager.getApplication().runReadAction(new Runnable() { - @Override - public void run() { - XDebugSession session = getSession().getXDebugSession(); - if (session != null) { - session.initBreakpoints(); - } - } - }); + XDebugSession session = getSession().getXDebugSession(); + if (session != null) { + session.initBreakpoints(); + } final String addressDisplayName = DebuggerBundle.getAddressDisplayName(getConnection()); final String transportName = DebuggerBundle.getTransportName(getConnection()); diff --git a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/XDebugSessionImpl.java b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/XDebugSessionImpl.java index 920027f23304..bdedcc29091a 100644 --- a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/XDebugSessionImpl.java +++ b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/XDebugSessionImpl.java @@ -46,6 +46,7 @@ import com.intellij.openapi.fileEditor.OpenFileDescriptor; import com.intellij.openapi.project.Project; import com.intellij.openapi.ui.MessageType; import com.intellij.openapi.util.Comparing; +import com.intellij.openapi.util.Computable; import com.intellij.openapi.util.text.StringUtil; import com.intellij.openapi.wm.ToolWindowId; import com.intellij.ui.AppUIUtil; @@ -367,7 +368,12 @@ public class XDebugSessionImpl implements XDebugSession { private > void processBreakpoints(final XBreakpointHandler handler, boolean register, final boolean temporary) { - Collection breakpoints = myDebuggerManager.getBreakpointManager().getBreakpoints(handler.getBreakpointTypeClass()); + Collection breakpoints = ApplicationManager.getApplication().runReadAction(new Computable>() { + @Override + public Collection compute() { + return myDebuggerManager.getBreakpointManager().getBreakpoints(handler.getBreakpointTypeClass()); + } + }); for (B b : breakpoints) { handleBreakpoint(handler, b, register, temporary); }