1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-08-18 13:45:45 +02:00

Make sure we can terminate a launch before we do it.

DSF throws an exception when we try to terminate a launch that's
already terminated.

Change-Id: Ie836e1f3e182b009ba4649a27afda716e8876885
This commit is contained in:
Doug Schaefer 2016-06-03 16:30:26 -04:00
parent c4d7ecfc60
commit 62545585be

View file

@ -53,14 +53,15 @@ public class StopActiveCommandHandler extends AbstractHandler {
return Status.OK_STATUS; return Status.OK_STATUS;
} }
for (ILaunch launch : activeLaunches) { for (ILaunch launch : activeLaunches) {
if (launch.canTerminate()) {
ILaunchConfiguration launchConfig = launch.getLaunchConfiguration(); ILaunchConfiguration launchConfig = launch.getLaunchConfiguration();
if (activeConfig.equals(launchConfig)) { if (activeConfig.equals(launchConfig)) {
launch.terminate(); launch.terminate();
continue; continue;
} }
if (launchConfig instanceof ILaunchConfigurationWorkingCopy) { if (launchConfig instanceof ILaunchConfigurationWorkingCopy) {
// There are evil delegates that use a working // There are evil delegates that use a
// copy for scratch storage // working copy for scratch storage
if (activeConfig if (activeConfig
.equals(((ILaunchConfigurationWorkingCopy) launchConfig).getOriginal())) { .equals(((ILaunchConfigurationWorkingCopy) launchConfig).getOriginal())) {
launch.terminate(); launch.terminate();
@ -68,6 +69,7 @@ public class StopActiveCommandHandler extends AbstractHandler {
} }
} }
} }
}
return Status.OK_STATUS; return Status.OK_STATUS;
} catch (CoreException e) { } catch (CoreException e) {
return e.getStatus(); return e.getStatus();