This is an automated email from the ASF dual-hosted git repository.

shanedell pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/daffodil-vscode.git


The following commit(s) were added to refs/heads/main by this push:
     new cd2f20a  Resolve issue that could cause the debugger to hang
cd2f20a is described below

commit cd2f20aaf4dd289b44b6f41652a06e1983e28f07
Author: Shane Dell <[email protected]>
AuthorDate: Thu Apr 10 15:24:39 2025 -0400

    Resolve issue that could cause the debugger to hang
    
    Closes #1225
---
 .../main/scala/org.apache.daffodil.debugger.dap/Parse.scala | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git 
a/debugger/src/main/scala/org.apache.daffodil.debugger.dap/Parse.scala 
b/debugger/src/main/scala/org.apache.daffodil.debugger.dap/Parse.scala
index fe7b915..dd2276a 100644
--- a/debugger/src/main/scala/org.apache.daffodil.debugger.dap/Parse.scala
+++ b/debugger/src/main/scala/org.apache.daffodil.debugger.dap/Parse.scala
@@ -107,13 +107,13 @@ object Parse {
             }
 
             val dataSize = data.available()
-            val dataInputStream = new InputSourceDataInputStream(data)
-            val parseResult = dp.parse(dataInputStream, infosetOutputter)
-            val loc = parseResult.location()
 
             val parse =
               IO.interruptibleMany(
-                parseResult
+                dp.parse(
+                  new InputSourceDataInputStream(data),
+                  infosetOutputter
+                )
                 // WARNING: parse doesn't close the OutputStream, so closed 
below
               ).flatTap { res =>
                 if (res.isError) {
@@ -130,8 +130,8 @@ object Parse {
               }.ensureOr { res =>
                 new Parse.Exception(res.getDiagnostics.toList)
               }(res => !res.isError)
-                .void
-                .flatMap { _ =>
+                .flatMap { parseResult =>
+                  val loc = parseResult.location()
                   val leftOverBits = (dataSize - (loc.bytePos1b - 1)) * 8
 
                   if (leftOverBits > 0) {
@@ -144,6 +144,7 @@ object Parse {
                     IO.unit
                   }
                 }
+                .void
                 .guarantee(IO(os.close) *> done.set(true))
 
             stopper &> parse

Reply via email to