1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-22 22:22:11 +02:00

Bug 509895 - GdbBasicCliConsole left running after platform shutdown

when launch fails

Change-Id: I5879f5ed770e63c11077e091f18c5766b243bd88
This commit is contained in:
Alvaro Sanchez-Leon 2017-01-10 06:59:19 -05:00 committed by Marc Khouzam
parent 6cad124cf0
commit 028eb67a17
5 changed files with 39 additions and 7 deletions

View file

@ -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

View file

@ -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>

View file

@ -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
}
}

View file

@ -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);

View file

@ -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) {