From 7eb0ff0caee1d809597c25ccb5251817edbe54a2 Mon Sep 17 00:00:00 2001 From: Vladimir Krivosheev Date: Mon, 28 Sep 2015 15:21:40 +0200 Subject: [PATCH] =?UTF-8?q?remove=20myBreakpointListener/myDependentBreakp?= =?UTF-8?q?ointListener=20listeners=20before=20debug=20process=20stop=20to?= =?UTF-8?q?=20avoid=20mystic=20erros=20=E2=80=94=20stop=20is=20async=20and?= =?UTF-8?q?,=20so,=20there=20is=20a=20time=20window=20when=20user=20can=20?= =?UTF-8?q?trigger=20breakpoint=20processing?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../xdebugger/impl/XDebugSessionImpl.java | 94 ++++++++++--------- 1 file changed, 49 insertions(+), 45 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 d8bc17315229..4a1de43a8fc0 100644 --- a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/XDebugSessionImpl.java +++ b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/XDebugSessionImpl.java @@ -871,54 +871,58 @@ public class XDebugSessionImpl implements XDebugSession { return; } - //noinspection unchecked - myDebugProcess.stopAsync().done(new Consumer() { - @Override - public void consume(Object aVoid) { - if (!myProject.isDisposed()) { - myProject.getMessageBus().syncPublisher(XDebuggerManager.TOPIC).processStopped(myDebugProcess); + try { + if (breakpointsInitialized) { + XBreakpointManagerImpl breakpointManager = myDebuggerManager.getBreakpointManager(); + if (myBreakpointListener != null) { + breakpointManager.removeBreakpointListener(myBreakpointListener); } - - if (mySessionTab != null) { - ((XWatchesViewImpl)mySessionTab.getWatchesView()).updateSessionData(); - mySessionTab.detachFromSession(); + if (myDependentBreakpointListener != null) { + breakpointManager.getDependentBreakpointManager().removeListener(myDependentBreakpointListener); } - else if (myConsoleView != null) { - AppUIUtil.invokeOnEdt(new Runnable() { - @Override - public void run() { - Disposer.dispose(myConsoleView); - } - }); - } - - myTopFramePosition = null; - myCurrentExecutionStack = null; - myCurrentStackFrame = null; - mySuspendContext = null; - - updateExecutionPosition(); - - if (breakpointsInitialized) { - XBreakpointManagerImpl breakpointManager = myDebuggerManager.getBreakpointManager(); - if (myBreakpointListener != null) { - breakpointManager.removeBreakpointListener(myBreakpointListener); - } - if (myDependentBreakpointListener != null) { - breakpointManager.getDependentBreakpointManager().removeListener(myDependentBreakpointListener); - } - } - if (myValueMarkers != null) { - myValueMarkers.clear(); - } - if (XDebuggerSettingsManager.getInstanceImpl().getGeneralSettings().isUnmuteOnStop()) { - mySessionData.setBreakpointsMuted(false); - } - myDebuggerManager.removeSession(XDebugSessionImpl.this); - myDispatcher.getMulticaster().sessionStopped(); - myProject.putUserData(XDebuggerEditorLinePainter.CACHE, null); } - }); + } + finally { + //noinspection unchecked + myDebugProcess.stopAsync().done(new Consumer() { + @Override + public void consume(Object aVoid) { + if (!myProject.isDisposed()) { + myProject.getMessageBus().syncPublisher(XDebuggerManager.TOPIC).processStopped(myDebugProcess); + } + + if (mySessionTab != null) { + ((XWatchesViewImpl)mySessionTab.getWatchesView()).updateSessionData(); + mySessionTab.detachFromSession(); + } + else if (myConsoleView != null) { + AppUIUtil.invokeOnEdt(new Runnable() { + @Override + public void run() { + Disposer.dispose(myConsoleView); + } + }); + } + + myTopFramePosition = null; + myCurrentExecutionStack = null; + myCurrentStackFrame = null; + mySuspendContext = null; + + updateExecutionPosition(); + + if (myValueMarkers != null) { + myValueMarkers.clear(); + } + if (XDebuggerSettingsManager.getInstanceImpl().getGeneralSettings().isUnmuteOnStop()) { + mySessionData.setBreakpointsMuted(false); + } + myDebuggerManager.removeSession(XDebugSessionImpl.this); + myDispatcher.getMulticaster().sessionStopped(); + myProject.putUserData(XDebuggerEditorLinePainter.CACHE, null); + } + }); + } } public boolean isInactiveSlaveBreakpoint(final XBreakpoint breakpoint) {