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 ef7555abc4ba..e394c2b8bda9 100644 --- a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/XDebugSessionImpl.java +++ b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/XDebugSessionImpl.java @@ -785,20 +785,21 @@ public class XDebugSessionImpl implements XDebugSession { updateExecutionPosition(); - if (myShowTabOnSuspend.compareAndSet(true, false)) { + final boolean showOnSuspend = myShowTabOnSuspend.compareAndSet(true, false); + if (showOnSuspend || attract) { AppUIUtil.invokeLaterIfProjectAlive(myProject, () -> { - initSessionTab(null); - showSessionTab(); - }); - } + if (showOnSuspend) { + initSessionTab(null); + showSessionTab(); + } - myDispatcher.getMulticaster().sessionPaused(); - - // user attractions should only be made if event happens independently (e.g. program paused/suspended) - // and should not be made when user steps in the code - if (attract) { - UIUtil.invokeLaterIfNeeded(() -> { - if (mySessionTab != null) { + // user attractions should only be made if event happens independently (e.g. program paused/suspended) + // and should not be made when user steps in the code + if (attract) { + if (mySessionTab == null) { + LOG.warn("Can not request focus because Session Tab is not initialized yet"); + return; + } if (XDebuggerSettingManagerImpl.getInstanceImpl().getGeneralSettings().isShowDebuggerOnBreakpoint()) { mySessionTab.toFront(true, this::updateExecutionPosition); @@ -814,6 +815,8 @@ public class XDebugSessionImpl implements XDebugSession { } }); } + + myDispatcher.getMulticaster().sessionPaused(); } @Override