Skip to content

Commit

Permalink
fix terminal element destroy. do not render if screen is destroyed.
Browse files Browse the repository at this point in the history
  • Loading branch information
chjj committed Aug 8, 2015
1 parent b54e86d commit 29c9d15
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 2 additions & 0 deletions lib/widgets/screen.js
Original file line number Diff line number Diff line change
Expand Up @@ -717,6 +717,8 @@ Screen.prototype.alloc = function() {
Screen.prototype.render = function() {
var self = this;

if (this.destroyed) return;

this.emit('prerender');

this._borderStops = {};
Expand Down
6 changes: 5 additions & 1 deletion lib/widgets/terminal.js
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ Terminal.prototype.bootstrap = function() {

this.on('destroy', function() {
self.kill();
self.screen.program.removeListener('data', self._onData);
self.screen.program.input.removeListener('data', self._onData);
});

if (this.handler) {
Expand Down Expand Up @@ -403,6 +403,10 @@ Terminal.prototype.kill = function() {
}
this.term.refresh = function() {};
this.term.write('\x1b[H\x1b[J');
if (this.term._blink) {
clearInterval(this.term._blink);
}
this.term.destroy();
};

/**
Expand Down

0 comments on commit 29c9d15

Please sign in to comment.