do not hold read lock for too long, during remote debugging initBreakpoints may take long

This commit is contained in:
Egor.Ushakov
2014-07-08 15:53:46 +04:00
parent 2f534a506a
commit d7e94bfb98
2 changed files with 11 additions and 10 deletions
@@ -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());
@@ -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 <B extends XBreakpoint<?>> void processBreakpoints(final XBreakpointHandler<B> handler,
boolean register,
final boolean temporary) {
Collection<? extends B> breakpoints = myDebuggerManager.getBreakpointManager().getBreakpoints(handler.getBreakpointTypeClass());
Collection<? extends B> breakpoints = ApplicationManager.getApplication().runReadAction(new Computable<Collection<? extends B>>() {
@Override
public Collection<? extends B> compute() {
return myDebuggerManager.getBreakpointManager().getBreakpoints(handler.getBreakpointTypeClass());
}
});
for (B b : breakpoints) {
handleBreakpoint(handler, b, register, temporary);
}