diff options
author | Alvaro Sanchez-Leon | 2017-01-10 11:59:19 +0000 |
---|---|---|
committer | Marc Khouzam | 2017-01-17 18:01:48 +0000 |
commit | 8f096340f42e67764eb379dfca44b2dcaf8d1d1f (patch) | |
tree | 6ee17d4582759db0b90fb3920dad0db3f6b79233 | |
parent | 9c3cd51e490132825f0f24f0b7c5317b15a6c86a (diff) | |
download | org.eclipse.cdt-8f096340f42e67764eb379dfca44b2dcaf8d1d1f.tar.gz org.eclipse.cdt-8f096340f42e67764eb379dfca44b2dcaf8d1d1f.tar.xz org.eclipse.cdt-8f096340f42e67764eb379dfca44b2dcaf8d1d1f.zip |
Bug 509895 - GdbBasicCliConsole left running after platform shutdown
when launch fails
Change-Id: I45f92c635af0bdb24e2bb88adf4f1df915cb4a0f
3 files changed, 40 insertions, 5 deletions
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 105e16fc195..86e5418091d 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 d4874699941..b3691c06c6f 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,18 @@ public class GdbCliConsoleManager implements ILaunchesListener2 { } } + protected void stopConsole(ILaunch launch) { + IDebuggerConsole console = getConsole(launch); + // validate the assumption that the console shall be + // of type IDBDebuggerConsole + assert console instanceof IGDBDebuggerConsole; + + if (console instanceof IGDBDebuggerConsole) { + IGDBDebuggerConsole gdbConsole = (IGDBDebuggerConsole) console; + gdbConsole.stop(); + } + } + private void renameConsole(ILaunch launch) { IDebuggerConsole console = getConsole(launch); if (console != null) { diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/console/IGDBDebuggerConsole.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/console/IGDBDebuggerConsole.java index 74b0715b426..f69068b93ce 100644 --- a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/console/IGDBDebuggerConsole.java +++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/console/IGDBDebuggerConsole.java @@ -54,4 +54,12 @@ public interface IGDBDebuggerConsole extends IDebuggerConsole { } }); } + + /** + * 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 + */ + default void stop() { + // Nothing to do by default + } } |