From e6ff1c5bd7993e118ca8f78b6186c5f06544bbd1 Mon Sep 17 00:00:00 2001 From: Marc Khouzam Date: Fri, 6 May 2011 19:27:55 +0000 Subject: [PATCH] Bug 345018: Do not allow to try to terminate GDB more than once --- .../cdt/dsf/gdb/service/command/GDBControl.java | 8 ++++++++ .../cdt/dsf/gdb/service/command/GDBControl_7_0.java | 10 +++++++++- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/command/GDBControl.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/command/GDBControl.java index 621cd227945..d2d3218f6bb 100644 --- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/command/GDBControl.java +++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/command/GDBControl.java @@ -99,6 +99,8 @@ public class GDBControl extends AbstractMIControl implements IGDBControl { private CLIEventProcessor fCLICommandProcessor; private AbstractCLIProcess fCLIProcess; + private boolean fTerminated; + /** * @since 3.0 */ @@ -176,6 +178,12 @@ public class GDBControl extends AbstractMIControl implements IGDBControl { } public void terminate(final RequestMonitor rm) { + if (fTerminated) { + rm.done(); + return; + } + fTerminated = true; + // To fix bug 234467: // Interrupt GDB in case the inferior is running. // That way, the inferior will also be killed when we exit GDB. diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/command/GDBControl_7_0.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/command/GDBControl_7_0.java index f8e050c4363..f098ca7d0b2 100644 --- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/command/GDBControl_7_0.java +++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/command/GDBControl_7_0.java @@ -103,6 +103,8 @@ public class GDBControl_7_0 extends AbstractMIControl implements IGDBControl { private List fFeatures = new ArrayList(); + private boolean fTerminated; + /** * @since 3.0 */ @@ -181,7 +183,13 @@ public class GDBControl_7_0 extends AbstractMIControl implements IGDBControl { } public void terminate(final RequestMonitor rm) { - // To fix bug 234467: + if (fTerminated) { + rm.done(); + return; + } + fTerminated = true; + + // To fix bug 234467: // Interrupt GDB in case the inferior is running. // That way, the inferior will also be killed when we exit GDB. //