mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
Bug 509895 - GdbBasicCliConsole left running after platform shutdown
when launch fails Change-Id: I45f92c635af0bdb24e2bb88adf4f1df915cb4a0f
This commit is contained in:
parent
9c3cd51e49
commit
8f096340f4
3 changed files with 40 additions and 5 deletions
|
@ -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);
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue