[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[tm-cvs-commit] moberhuber org.eclipse.tm.core/terminal/org.eclipse.tm.terminal/src/org/eclipse/tm/internal/terminal/emulator VT100TerminalControl.java

Update of /cvsroot/tools/org.eclipse.tm.core/terminal/org.eclipse.tm.terminal/src/org/eclipse/tm/internal/terminal/emulator
In directory dev2:/tmp/cvs-serv25361/src/org/eclipse/tm/internal/terminal/emulator

Modified Files:
	VT100TerminalControl.java 
Log Message:
Bug 348700 - [terminal] Regression: Terminal is unusable after "Disconnect"

Index: VT100TerminalControl.java
===================================================================
RCS file: /cvsroot/tools/org.eclipse.tm.core/terminal/org.eclipse.tm.terminal/src/org/eclipse/tm/internal/terminal/emulator/VT100TerminalControl.java,v
retrieving revision 1.33
retrieving revision 1.34
diff -C2 -d -r1.33 -r1.34
*** VT100TerminalControl.java	8 Jun 2011 10:32:48 -0000	1.33
--- VT100TerminalControl.java	8 Jun 2011 13:25:49 -0000	1.34
***************
*** 29,32 ****
--- 29,33 ----
   * Max Stepanov (Appcelerator) - [339768] Fix ANSI code for PgUp / PgDn
   * Pawel Piech (Wind River) - [333613] "Job found still running" after shutdown
+  * Martin Oberhuber (Wind River) - [348700] Terminal unusable after disconnect
   *******************************************************************************/
  package org.eclipse.tm.internal.terminal.emulator;
***************
*** 348,354 ****
  		Logger.log("entered."); //$NON-NLS-1$
  
          //Ensure that a new Job can be started; then clean up old Job.
-         //TODO not sure whether the fInputStream needs to be cleaned too,
-         //or whether the Job could actually cancel in case the fInputStream is closed.
          Job job;
          synchronized(this) {
--- 349,360 ----
  		Logger.log("entered."); //$NON-NLS-1$
  
+ 		//Disconnect the remote side first
+ 		if (getState()!=TerminalState.CLOSED) {
+ 			if(getTerminalConnector()!=null) {
+ 				getTerminalConnector().disconnect();
+ 			}
+ 		}
+ 		
          //Ensure that a new Job can be started; then clean up old Job.
          Job job;
          synchronized(this) {
***************
*** 359,378 ****
              job.cancel();
              // Join job to avoid leaving job running after workbench shutdown (333613).
              try {
-      			// The Job will check its cancel status after 500msec latest. But we still
-                 // Interrupt the Job, such that it can join fast enough during Workbench shutdown (bug 333613).
-                 // TODO closing fInputStream may seem more clean but causes problems (bug 348700).
-                 Thread t = job.getThread();
-                 if(t!=null) t.interrupt();
                  job.join();
              } catch (InterruptedException e) {}
          }
- 		
- 		if (getState()==TerminalState.CLOSED) {
- 			return;
- 		}
- 		if(getTerminalConnector()!=null) {
- 			getTerminalConnector().disconnect();
- 		}
  	}
  
--- 365,375 ----
              job.cancel();
              // Join job to avoid leaving job running after workbench shutdown (333613).
+             // Interrupt to be fast enough; cannot close fInputStream since it is re-used (bug 348700).
+             Thread t = job.getThread();
+             if(t!=null) t.interrupt();
              try {
                  job.join();
              } catch (InterruptedException e) {}
          }
  	}