git://git.nikiroo.be
/
fanfix.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
#51 wip
[fanfix.git]
/
src
/
jexer
/
TTerminalWidget.java
diff --git
a/src/jexer/TTerminalWidget.java
b/src/jexer/TTerminalWidget.java
index 7a93f4e7b32320c69ade2090049146e9200fdef0..39d761c64a1b2ae06fe2df6a5cbd1a143a8b4b5e 100644
(file)
--- a/
src/jexer/TTerminalWidget.java
+++ b/
src/jexer/TTerminalWidget.java
@@
-384,6
+384,14
@@
public class TTerminalWidget extends TScrollableWidget
// Update the scroll bars
reflowData();
// Update the scroll bars
reflowData();
+ if (!isDrawable()) {
+ // We lost the connection, onShellExit() called an action
+ // that ultimately removed this widget from the UI
+ // hierarchy, so no one cares if we update the display.
+ // Bail out.
+ return;
+ }
+
if ((scrollback == null) || emulator.isReading()) {
scrollback = copyBuffer(emulator.getScrollbackBuffer());
display = copyBuffer(emulator.getDisplayBuffer());
if ((scrollback == null) || emulator.isReading()) {
scrollback = copyBuffer(emulator.getScrollbackBuffer());
display = copyBuffer(emulator.getDisplayBuffer());
@@
-820,17
+828,19
@@
public class TTerminalWidget extends TScrollableWidget
public void onShellExit() {
TApplication app = getApplication();
if (app != null) {
public void onShellExit() {
TApplication app = getApplication();
if (app != null) {
- app.invokeLater(new Runnable() {
- public void run() {
- if (closeAction != null) {
+ if (closeAction != null) {
+ // We have to put this action inside invokeLater() because it
+ // could be executed during draw() when syncing with ECMA48.
+ app.invokeLater(new Runnable() {
+ public void run() {
closeAction.DO(TTerminalWidget.this);
}
closeAction.DO(TTerminalWidget.this);
}
- if (getApplication() != null) {
- getApplication().postEvent(new TMenuEvent(
- TMenu.MID_REPAINT));
- }
- }
- }
);
+ });
+ }
+ if (getApplication() != null) {
+ getApplication().postEvent(new TMenuEvent(
+ TMenu.MID_REPAINT));
+ }
}
}
}
}