Commit 0bbbdbaf authored by Roumen Petrov's avatar Roumen Petrov

initialize terminal emulator synchronously

Also prevent double initialization.
Note that initialization is called from updateSize emulator is not set!
But updateSize is called from EmulatorView on events. Those evens could be triggered before initialization to be finished.
parent a93f4e70
......@@ -162,13 +162,7 @@ protected void onProcessExit() {
* @param rows The number of rows in the terminal window.
*/
public void initializeEmulator(int columns, int rows) {
mTranscriptScreen = new TranscriptScreen(columns, TRANSCRIPT_ROWS, rows, mColorScheme);
mEmulator = new TerminalEmulator(this, mTranscriptScreen, columns, rows, mColorScheme);
mEmulator.setKeyListener(mKeyListener);
mIsRunning = true;
mReaderThread.start();
mWriterThread.start();
initializeEmulatorLocal(columns, rows);
}
/**
......@@ -542,6 +536,20 @@ public void finish() {
finalizeEmulator();
}
private synchronized void initializeEmulatorLocal(int columns, int rows) {
if (mIsRunning) return;
mTranscriptScreen = new TranscriptScreen(columns, TRANSCRIPT_ROWS, rows, mColorScheme);
mEmulator = new TerminalEmulator(this, mTranscriptScreen, columns, rows, mColorScheme);
mEmulator.setKeyListener(mKeyListener);
mReaderThread.start();
mWriterThread.start();
mIsRunning = true;
}
private synchronized void finalizeEmulator() {
if (mFinishCallback != null) {
mFinishCallback.onSessionFinish(this);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment