mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-13 20:15:22 +02:00
[208145] Terminal prints garbage after quick disconnect-reconnect
This commit is contained in:
parent
86694a4b08
commit
02f20b5086
1 changed files with 28 additions and 20 deletions
|
@ -15,6 +15,7 @@
|
||||||
* Martin Oberhuber (Wind River) - fixed copyright headers and beautified
|
* Martin Oberhuber (Wind River) - fixed copyright headers and beautified
|
||||||
* Martin Oberhuber (Wind River) - [206892] State handling: Only allow connect when CLOSED
|
* Martin Oberhuber (Wind River) - [206892] State handling: Only allow connect when CLOSED
|
||||||
* Martin Oberhuber (Wind River) - [206883] Serial Terminal leaks Jobs
|
* Martin Oberhuber (Wind River) - [206883] Serial Terminal leaks Jobs
|
||||||
|
* Martin Oberhuber (Wind River) - [208145] Terminal prints garbage after quick disconnect/reconnect
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.tm.internal.terminal.emulator;
|
package org.eclipse.tm.internal.terminal.emulator;
|
||||||
|
|
||||||
|
@ -337,31 +338,38 @@ public class VT100TerminalControl implements ITerminalControlForText, ITerminalC
|
||||||
fJob=new Job("Terminal data reader") { //$NON-NLS-1$
|
fJob=new Job("Terminal data reader") { //$NON-NLS-1$
|
||||||
protected IStatus run(IProgressMonitor monitor) {
|
protected IStatus run(IProgressMonitor monitor) {
|
||||||
IStatus status=Status.OK_STATUS;
|
IStatus status=Status.OK_STATUS;
|
||||||
while(true) {
|
try {
|
||||||
while(fInputStream.available()==0 && !monitor.isCanceled()) {
|
while(true) {
|
||||||
|
while(fInputStream.available()==0 && !monitor.isCanceled()) {
|
||||||
|
try {
|
||||||
|
fInputStream.waitForAvailable(500);
|
||||||
|
} catch (InterruptedException e) {
|
||||||
|
Thread.currentThread().interrupt();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(monitor.isCanceled()) {
|
||||||
|
//Do not disconnect terminal here because another reader job may already be running
|
||||||
|
status=Status.CANCEL_STATUS;
|
||||||
|
break;
|
||||||
|
}
|
||||||
try {
|
try {
|
||||||
fInputStream.waitForAvailable(500);
|
// TODO: should block when no text is available!
|
||||||
} catch (InterruptedException e) {
|
fTerminalText.processText();
|
||||||
Thread.currentThread().interrupt();
|
} catch (Exception e) {
|
||||||
|
disconnectTerminal();
|
||||||
|
status=new Status(IStatus.ERROR,TerminalPlugin.PLUGIN_ID,e.getLocalizedMessage(),e);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(monitor.isCanceled()) {
|
} finally {
|
||||||
disconnectTerminal();
|
// clean the job: start a new one when the connection gets restarted
|
||||||
status=Status.CANCEL_STATUS;
|
// Bug 208145: make sure we do not clean an other job that's already started (since it would become a Zombie)
|
||||||
break;
|
synchronized (VT100TerminalControl.this) {
|
||||||
}
|
if (fJob==this) {
|
||||||
try {
|
fJob=null;
|
||||||
// TODO: should block when no text is available!
|
}
|
||||||
fTerminalText.processText();
|
|
||||||
|
|
||||||
} catch (Exception e) {
|
|
||||||
disconnectTerminal();
|
|
||||||
status=new Status(IStatus.ERROR,TerminalPlugin.PLUGIN_ID,e.getLocalizedMessage(),e);
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// clean the job: start a new one when the connection getst restarted
|
|
||||||
fJob=null;
|
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue