Browse Source

Defer removal of components.

Can't remove components while others are being processed, else GL gets
confused and misses out delivering messages to some. Also disposes
editors, and makes sure output windows are closed when their parent is
closed.

Fixes #347
dev/git-series/gccdum
Matt Godbolt 6 years ago
parent
commit
5f4638a240
  1. 7
      static/compiler.js
  2. 1
      static/diff.js
  3. 11
      static/output.js

7
static/compiler.js

@ -130,6 +130,7 @@ define(function (require) {
container.on('destroy', function () {
self.eventHub.unsubscribe();
self.eventHub.emit('compilerClose', self.id);
self.outputEditor.dispose();
}, this);
container.on('resize', this.resize, this);
container.on('shown', this.resize, this);
@ -448,7 +449,11 @@ define(function (require) {
Compiler.prototype.onEditorClose = function (editor) {
if (editor === this.sourceEditorId) {
this.container.close();
// We can't immediately close as an outer loop somewhere in GoldenLayout is iterating over
// the hierarchy. We can't modify while it's being iterated over.
_.defer(function (self) {
self.container.close();
}, this);
}
};

1
static/diff.js

@ -107,6 +107,7 @@ define(function (require) {
this.container.on('destroy', function () {
this.eventHub.unsubscribe();
this.outputEditor.dispose();
}, this);
container.on('resize', this.resize, this);
container.on('shown', this.resize, this);

11
static/output.js

@ -44,6 +44,7 @@ define(function (require) {
this.eventHub.on('compileResult', this.onCompileResult, this);
this.eventHub.emit('resendCompilation', this.compilerId);
this.eventHub.on('compilerFontScale', this.onFontScale, this);
this.eventHub.on('compilerClose', this.onCompilerClose, this);
this.updateCompilerName();
}
@ -88,6 +89,16 @@ define(function (require) {
this.container.setTitle(name);
};
Output.prototype.onCompilerClose = function (id) {
if (id === this.compilerId) {
// We can't immediately close as an outer loop somewhere in GoldenLayout is iterating over
// the hierarchy. We can't modify while it's being iterated over.
_.defer(function (self) {
self.container.close();
}, this);
}
};
return {
Output: Output
};

Loading…
Cancel
Save