mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-08-08 08:45:44 +02:00
Bug 525666: Fix NPE when DebuggerConsole closes before async code can run
Fix the async calls that can run after the DebuggerConsole is closed and removed so that they can't NPE. Change-Id: I7905ee18a92be0ff5de25a4c8d770a694b06bfe1
This commit is contained in:
parent
94b8301bbc
commit
cfd6e9867e
1 changed files with 10 additions and 2 deletions
|
@ -128,7 +128,10 @@ public class GdbBasicCliConsole extends IOConsole implements IGDBDebuggerConsole
|
||||||
int bufferLines = store.getInt(IGdbDebugPreferenceConstants.PREF_CONSOLE_BUFFERLINES);
|
int bufferLines = store.getInt(IGdbDebugPreferenceConstants.PREF_CONSOLE_BUFFERLINES);
|
||||||
|
|
||||||
Display.getDefault().asyncExec(() -> {
|
Display.getDefault().asyncExec(() -> {
|
||||||
getInputStream().setColor(Display.getDefault().getSystemColor(SWT.COLOR_GREEN));
|
IOConsoleInputStream inputStream = getInputStream();
|
||||||
|
if (inputStream != null) {
|
||||||
|
inputStream.setColor(Display.getDefault().getSystemColor(SWT.COLOR_GREEN));
|
||||||
|
}
|
||||||
fErrorStream.setColor(Display.getDefault().getSystemColor(SWT.COLOR_RED));
|
fErrorStream.setColor(Display.getDefault().getSystemColor(SWT.COLOR_RED));
|
||||||
|
|
||||||
setInvertedColors(enabled);
|
setInvertedColors(enabled);
|
||||||
|
@ -235,10 +238,15 @@ public class GdbBasicCliConsole extends IOConsole implements IGDBDebuggerConsole
|
||||||
byte[] b = new byte[1024];
|
byte[] b = new byte[1024];
|
||||||
int read = 0;
|
int read = 0;
|
||||||
do {
|
do {
|
||||||
read = getInputStream().read(b);
|
IOConsoleInputStream inputStream = getInputStream();
|
||||||
|
if (inputStream == null) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
read = inputStream.read(b);
|
||||||
if (read > 0) {
|
if (read > 0) {
|
||||||
fProcess.getOutputStream().write(b, 0, read);
|
fProcess.getOutputStream().write(b, 0, read);
|
||||||
}
|
}
|
||||||
|
|
||||||
} while (read >= 0);
|
} while (read >= 0);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue