From 3db6c389398bfc056433f475cafaed880fc62a0c Mon Sep 17 00:00:00 2001 From: Alexander Kuznetsov Date: Mon, 24 Mar 2025 23:19:27 +0100 Subject: [PATCH] [rd][debugger] IJPL-177087 FrontendXDebuggerSession: Handle flows cancellation GitOrigin-RevId: c7d3efa2a380dd73cdd23ac6854eb1c9e582a2fc --- .../impl/frontend/FrontendXDebuggerSession.kt | 22 +++++++++---------- 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/platform/xdebugger-impl/frontend/src/com/intellij/platform/debugger/impl/frontend/FrontendXDebuggerSession.kt b/platform/xdebugger-impl/frontend/src/com/intellij/platform/debugger/impl/frontend/FrontendXDebuggerSession.kt index bccccba57a8c..cc77cf75f6e1 100644 --- a/platform/xdebugger-impl/frontend/src/com/intellij/platform/debugger/impl/frontend/FrontendXDebuggerSession.kt +++ b/platform/xdebugger-impl/frontend/src/com/intellij/platform/debugger/impl/frontend/FrontendXDebuggerSession.kt @@ -90,16 +90,10 @@ internal class FrontendXDebuggerSession private constructor( send(null) return@collectLatest } - val childScope = cs.childScope( - "Suspend Context ${suspendContextDto.id}" - ) - try { - send(FrontendXSuspendContext(suspendContextDto, childScope)) + supervisorScope { + send(FrontendXSuspendContext(suspendContextDto, this)) awaitCancellation() } - finally { - childScope.cancel() - } } }.stateIn(cs, SharingStarted.Eagerly, null) @@ -110,8 +104,10 @@ internal class FrontendXDebuggerSession private constructor( send(null) return@collectLatest } - // TODO[IJPL-177087] narrower scope? - send(FrontendXExecutionStack(executionStackDto, cs)) + supervisorScope { + send(FrontendXExecutionStack(executionStackDto, this)) + awaitCancellation() + } } }.stateIn(cs, SharingStarted.Eagerly, null) @@ -122,8 +118,10 @@ internal class FrontendXDebuggerSession private constructor( send(null) return@collectLatest } - return@collectLatest - send(FrontendXStackFrame(stackFrameDto)) + supervisorScope { + send(FrontendXStackFrame(stackFrameDto)) + awaitCancellation() + } } }.stateIn(cs, SharingStarted.Eagerly, null)