From e60ef74ebbe3a6af27bc31bf0ade1ece530eb57d Mon Sep 17 00:00:00 2001 From: Jonah Graham Date: Mon, 25 Oct 2021 16:14:43 -0400 Subject: [PATCH] Bug 576884: Ignore unsuitable adapter when the UI layer isn't running When the UI layer is running the correct terminate adapter is returned, when the UI layer is not running, the Launch.terminate code is a valid fallback, and the org.eclipse.debug.internal.core.commands.TerminateCommand is not an appropriate adapter to use. Change-Id: I3c4c273b78b4e5bc9fe521b4a24ef5443852d3c0 --- .../org/eclipse/cdt/dsf/gdb/launching/GdbLaunch.java | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/launching/GdbLaunch.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/launching/GdbLaunch.java index 2ff36fd4ee6..e072dd4c4de 100644 --- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/launching/GdbLaunch.java +++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/launching/GdbLaunch.java @@ -303,6 +303,17 @@ public class GdbLaunch extends DsfLaunch implements ITracedLaunch, ITargetedLaun return; } + if (handler instanceof org.eclipse.debug.internal.core.commands.TerminateCommand) { + // The org.eclipse.debug.internal.core.commands.TerminateCommand adapter + // calls Launch#terminate (asynchronously) so don't use that adapter. + // This special case code is needed because of behaviour changes + // introduced in Platform. See Bug 576622 and Bug 576024. CDT, when running + // tests, was relying on the undocumented behaviour that meant getAdapter + // was returning null here. + super.terminate(); + return; + } + LaunchCommandRequest req = new LaunchCommandRequest(new Object[] { this }); handler.execute(req); }