From f1f59814458989b3c2d1bd2d972e803e29bfe0b7 Mon Sep 17 00:00:00 2001 From: Antonio Garcia-Dominguez Date: Thu, 29 Aug 2024 00:15:15 +0100 Subject: [PATCH] [DAP] Only need to add completion listener to main module The language-specific debuggers are the ones responsible for copying over execution listeners when we cross language boundaries. This avoids one risk related to concurrent modifications and accesses of the execution listeners. --- .../epsilon/eol/dap/EpsilonDebugAdapter.java | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/plugins/org.eclipse.epsilon.eol.dap/src/org/eclipse/epsilon/eol/dap/EpsilonDebugAdapter.java b/plugins/org.eclipse.epsilon.eol.dap/src/org/eclipse/epsilon/eol/dap/EpsilonDebugAdapter.java index da7264250..eca030eeb 100644 --- a/plugins/org.eclipse.epsilon.eol.dap/src/org/eclipse/epsilon/eol/dap/EpsilonDebugAdapter.java +++ b/plugins/org.eclipse.epsilon.eol.dap/src/org/eclipse/epsilon/eol/dap/EpsilonDebugAdapter.java @@ -323,18 +323,6 @@ protected ThreadState attachTo(IEolModule module) { module.getContext().getExecutorFactory().setExecutionController(thread.debugger); } - // Attach the completion listener to this module, if we haven't done so yet - boolean hasListener = false; - for (IExecutionListener l : module.getContext().getExecutorFactory().getExecutionListeners()) { - if (l == completionListener) { - hasListener = true; - break; - } - } - if (!hasListener) { - module.getContext().getExecutorFactory().addExecutionListener(completionListener); - } - // Attach to the module's output and error streams final PrintStream outStream = createStream(module.getContext(), OutputEventArgumentsCategory.STDOUT); module.getContext().setOutputStream(outStream); @@ -397,6 +385,7 @@ public void connect(IDebugProtocolClient client) { throw new IllegalStateException("connect(): the module has not been set up yet"); } attachTo(mainModule); + mainModule.getContext().getExecutorFactory().addExecutionListener(completionListener); this.client = client; client.initialized();