diff --git a/java/debugger/impl/src/com/intellij/debugger/engine/events/SuspendContextCommandImpl.java b/java/debugger/impl/src/com/intellij/debugger/engine/events/SuspendContextCommandImpl.java index f3ad39594d3a..739c96270cca 100644 --- a/java/debugger/impl/src/com/intellij/debugger/engine/events/SuspendContextCommandImpl.java +++ b/java/debugger/impl/src/com/intellij/debugger/engine/events/SuspendContextCommandImpl.java @@ -67,16 +67,23 @@ public abstract class SuspendContextCommandImpl extends DebuggerCommandImpl { } finally{ suspendContext.myInProgress = false; - SuspendContextCommandImpl postponed = suspendContext.pollPostponedCommand(); - if (postponed != null) { - final Stack stack = new Stack(); - while (postponed != null) { - stack.push(postponed); - postponed = suspendContext.pollPostponedCommand(); + if (suspendContext.isResumed()) { + for (SuspendContextCommandImpl postponed = suspendContext.pollPostponedCommand(); postponed != null; postponed = suspendContext.pollPostponedCommand()) { + postponed.notifyCancelled(); } - final DebuggerManagerThreadImpl managerThread = suspendContext.getDebugProcess().getManagerThread(); - while (!stack.isEmpty()) { - managerThread.pushBack(stack.pop()); + } + else { + SuspendContextCommandImpl postponed = suspendContext.pollPostponedCommand(); + if (postponed != null) { + final Stack stack = new Stack(); + while (postponed != null) { + stack.push(postponed); + postponed = suspendContext.pollPostponedCommand(); + } + final DebuggerManagerThreadImpl managerThread = suspendContext.getDebugProcess().getManagerThread(); + while (!stack.isEmpty()) { + managerThread.pushBack(stack.pop()); + } } } }