Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlvaro Sanchez-Leon2017-01-10 06:59:19 -0500
committerMarc Khouzam2017-01-17 11:49:15 -0500
commit028eb67a17b5546681eb7785a6c7febca776d46c (patch)
treec62ab3cafe4eb7282bd54706fd28ebcac4c6fee0
parent6cad124cf0c38f1eca85ae9e08929d1eefcb63ad (diff)
downloadorg.eclipse.cdt-028eb67a17b5546681eb7785a6c7febca776d46c.tar.gz
org.eclipse.cdt-028eb67a17b5546681eb7785a6c7febca776d46c.tar.xz
org.eclipse.cdt-028eb67a17b5546681eb7785a6c7febca776d46c.zip
Bug 509895 - GdbBasicCliConsole left running after platform shutdown
when launch fails Change-Id: I5879f5ed770e63c11077e091f18c5766b243bd88
-rw-r--r--debug/org.eclipse.cdt.debug.ui/META-INF/MANIFEST.MF2
-rw-r--r--debug/org.eclipse.cdt.debug.ui/pom.xml2
-rw-r--r--debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/debuggerconsole/IDebuggerConsole.java9
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/console/GdbBasicCliConsole.java22
-rw-r--r--dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/console/GdbCliConsoleManager.java11
5 files changed, 39 insertions, 7 deletions
diff --git a/debug/org.eclipse.cdt.debug.ui/META-INF/MANIFEST.MF b/debug/org.eclipse.cdt.debug.ui/META-INF/MANIFEST.MF
index b30629b0c4..a7ded1aa54 100644
--- a/debug/org.eclipse.cdt.debug.ui/META-INF/MANIFEST.MF
+++ b/debug/org.eclipse.cdt.debug.ui/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.cdt.debug.ui; singleton:=true
-Bundle-Version: 8.1.0.qualifier
+Bundle-Version: 8.2.0.qualifier
Bundle-Activator: org.eclipse.cdt.debug.ui.CDebugUIPlugin
Bundle-Vendor: %providerName
Bundle-Localization: plugin
diff --git a/debug/org.eclipse.cdt.debug.ui/pom.xml b/debug/org.eclipse.cdt.debug.ui/pom.xml
index 0395071643..1a53822c7b 100644
--- a/debug/org.eclipse.cdt.debug.ui/pom.xml
+++ b/debug/org.eclipse.cdt.debug.ui/pom.xml
@@ -11,7 +11,7 @@
<relativePath>../../pom.xml</relativePath>
</parent>
- <version>8.1.0-SNAPSHOT</version>
+ <version>8.2.0-SNAPSHOT</version>
<artifactId>org.eclipse.cdt.debug.ui</artifactId>
<packaging>eclipse-plugin</packaging>
</project>
diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/debuggerconsole/IDebuggerConsole.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/debuggerconsole/IDebuggerConsole.java
index 9716d28d1a..56c5ac7973 100644
--- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/debuggerconsole/IDebuggerConsole.java
+++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/debuggerconsole/IDebuggerConsole.java
@@ -41,4 +41,13 @@ public interface IDebuggerConsole extends IConsole {
* notification to e.g. keep other views in sync with the context of the console
*/
void consoleSelected();
+
+ /**
+ * Stop processing but don't dispose this console yet,
+ * i.e. It's desirable to keep the last I/O information available to the user
+ * @since 8.2
+ */
+ default void stop() {
+ // Nothing to do by default
+ }
}
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/console/GdbBasicCliConsole.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/console/GdbBasicCliConsole.java
index 105e16fc19..86e5418091 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/console/GdbBasicCliConsole.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/console/GdbBasicCliConsole.java
@@ -27,6 +27,7 @@ import org.eclipse.swt.widgets.Display;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.console.IConsoleView;
import org.eclipse.ui.console.IOConsole;
+import org.eclipse.ui.console.IOConsoleInputStream;
import org.eclipse.ui.console.IOConsoleOutputStream;
import org.eclipse.ui.part.IPageBookViewPage;
@@ -93,7 +94,14 @@ public class GdbBasicCliConsole extends IOConsole implements IGDBDebuggerConsole
@Override
protected void dispose() {
- try {
+ stop();
+ super.dispose();
+ }
+
+ @Override
+ public void stop() {
+ // Closing the streams will trigger the termination of the associated reading jobs
+ try {
fOutputStream.close();
} catch (IOException e) {
}
@@ -102,11 +110,17 @@ public class GdbBasicCliConsole extends IOConsole implements IGDBDebuggerConsole
} catch (IOException e) {
}
- GdbUIPlugin.getDefault().getPreferenceStore().removePropertyChangeListener(fPreferenceListener);
+ IOConsoleInputStream istream = getInputStream();
+ if (istream != null) {
+ try {
+ istream.close();
+ } catch (IOException e) {
+ }
+ }
- super.dispose();
+ GdbUIPlugin.getDefault().getPreferenceStore().removePropertyChangeListener(fPreferenceListener);
}
-
+
private void setDefaults() {
IPreferenceStore store = GdbUIPlugin.getDefault().getPreferenceStore();
boolean enabled = store.getBoolean(IGdbDebugPreferenceConstants.PREF_CONSOLE_INVERTED_COLORS);
diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/console/GdbCliConsoleManager.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/console/GdbCliConsoleManager.java
index d487469994..ae0604cdbb 100644
--- a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/console/GdbCliConsoleManager.java
+++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/console/GdbCliConsoleManager.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2016 Ericsson and others.
+ * Copyright (c) 2016, 2017 Ericsson and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -78,6 +78,7 @@ public class GdbCliConsoleManager implements ILaunchesListener2 {
public void launchesTerminated(ILaunch[] launches) {
for (ILaunch launch : launches) {
renameConsole(launch);
+ stopConsole(launch);
}
}
@@ -95,6 +96,14 @@ public class GdbCliConsoleManager implements ILaunchesListener2 {
}
}
+ protected void stopConsole(ILaunch launch) {
+ IDebuggerConsole console = getConsole(launch);
+
+ if (console != null) {
+ console.stop();
+ }
+ }
+
private void renameConsole(ILaunch launch) {
IDebuggerConsole console = getConsole(launch);
if (console != null) {

Back to the top