diff options
Diffstat (limited to 'platform/xdebugger-impl/src/com/intellij/xdebugger/impl/XDebugSessionImpl.java')
-rw-r--r-- | platform/xdebugger-impl/src/com/intellij/xdebugger/impl/XDebugSessionImpl.java | 31 |
1 files changed, 17 insertions, 14 deletions
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 9ab13ba0ae74..762855510a1e 100644 --- a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/XDebugSessionImpl.java +++ b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/XDebugSessionImpl.java @@ -46,7 +46,6 @@ 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; @@ -91,7 +90,7 @@ public class XDebugSessionImpl implements XDebugSession { private XDebugProcess myDebugProcess; private final Map<XBreakpoint<?>, CustomizedBreakpointPresentation> myRegisteredBreakpoints = new THashMap<XBreakpoint<?>, CustomizedBreakpointPresentation>(); - private final Set<XBreakpoint<?>> myInactiveSlaveBreakpoints = new SmartHashSet<XBreakpoint<?>>(); + private final Set<XBreakpoint<?>> myInactiveSlaveBreakpoints = Collections.synchronizedSet(new SmartHashSet<XBreakpoint<?>>()); private boolean myBreakpointsDisabled; private final XDebuggerManagerImpl myDebuggerManager; private MyBreakpointListener myBreakpointListener; @@ -103,7 +102,7 @@ public class XDebugSessionImpl implements XDebugSession { private MyDependentBreakpointListener myDependentBreakpointListener; private XValueMarkers<?, ?> myValueMarkers; private final String mySessionName; - private XDebugSessionTab mySessionTab; + private @Nullable XDebugSessionTab mySessionTab; private XDebugSessionData mySessionData; private XBreakpoint<?> myActiveNonLineBreakpoint; private final EventDispatcher<XDebugSessionListener> myDispatcher = EventDispatcher.create(XDebugSessionListener.class); @@ -289,6 +288,7 @@ public class XDebugSessionImpl implements XDebugSession { @Override public void initBreakpoints() { + ApplicationManager.getApplication().assertReadAccessAllowed(); LOG.assertTrue(!breakpointsInitialized); breakpointsInitialized = true; @@ -308,12 +308,14 @@ public class XDebugSessionImpl implements XDebugSession { return myConsoleView; } + @Nullable public XDebugSessionTab getSessionTab() { return mySessionTab; } @Override public RunnerLayoutUi getUI() { + assertSessionTabInitialized(); return mySessionTab.getUi(); } @@ -368,12 +370,7 @@ public class XDebugSessionImpl implements XDebugSession { private <B extends XBreakpoint<?>> void processBreakpoints(final XBreakpointHandler<B> handler, boolean register, final boolean temporary) { - Collection<? extends B> breakpoints = ApplicationManager.getApplication().runReadAction(new Computable<Collection<? extends B>>() { - @Override - public Collection<? extends B> compute() { - return myDebuggerManager.getBreakpointManager().getBreakpoints(handler.getBreakpointTypeClass()); - } - }); + Collection<? extends B> breakpoints = myDebuggerManager.getBreakpointManager().getBreakpoints(handler.getBreakpointTypeClass()); for (B b : breakpoints) { handleBreakpoint(handler, b, register, temporary); } @@ -422,8 +419,9 @@ public class XDebugSessionImpl implements XDebugSession { } } - private boolean isBreakpointActive(final XBreakpoint<?> b) { - return !areBreakpointsMuted() && b.isEnabled() && !myInactiveSlaveBreakpoints.contains(b); + public boolean isBreakpointActive(final XBreakpoint<?> b) { + ApplicationManager.getApplication().assertReadAccessAllowed(); + return !areBreakpointsMuted() && b.isEnabled() && !isInactiveSlaveBreakpoint(b); } @Override @@ -448,6 +446,7 @@ public class XDebugSessionImpl implements XDebugSession { @Override public void setBreakpointMuted(boolean muted) { + ApplicationManager.getApplication().assertReadAccessAllowed(); if (areBreakpointsMuted() == muted) return; mySessionData.setBreakpointsMuted(muted); processAllBreakpoints(!muted, muted); @@ -714,8 +713,10 @@ public class XDebugSessionImpl implements XDebugSession { UIUtil.invokeLaterIfNeeded(new Runnable() { @Override public void run() { - mySessionTab.toFront(); - mySessionTab.getUi().attractBy(XDebuggerUIConstants.LAYOUT_VIEW_BREAKPOINT_CONDITION); + if (mySessionTab != null) { + mySessionTab.toFront(true); + mySessionTab.getUi().attractBy(XDebuggerUIConstants.LAYOUT_VIEW_BREAKPOINT_CONDITION); + } } }); @@ -847,7 +848,9 @@ public class XDebugSessionImpl implements XDebugSession { if (myStopped) return; myDebugProcess.stop(); - myProject.getMessageBus().syncPublisher(XDebuggerManager.TOPIC).processStopped(myDebugProcess); + if (!myProject.isDisposed()) { + myProject.getMessageBus().syncPublisher(XDebuggerManager.TOPIC).processStopped(myDebugProcess); + } myCurrentPosition = null; myCurrentExecutionStack = null; myCurrentStackFrame = null; |