Guard against setting on destroyed object

pull/19210/head
wenincode 1 year ago
parent 220ae01ab7
commit e02fd67ad9

@ -36,22 +36,24 @@ export default Component.extend({
}
},
setMode: function (mode) {
let options = {
...DEFAULTS,
mode: mode.mime,
readOnly: this.readonly,
};
if (mode.name === 'XML') {
options.htmlMode = mode.htmlMode;
options.matchClosing = mode.matchClosing;
options.alignCDATA = mode.alignCDATA;
}
set(this, 'options', options);
if (!this.isDestroying && !this.isDestroyed) {
let options = {
...DEFAULTS,
mode: mode.mime,
readOnly: this.readonly,
};
if (mode.name === 'XML') {
options.htmlMode = mode.htmlMode;
options.matchClosing = mode.matchClosing;
options.alignCDATA = mode.alignCDATA;
}
set(this, 'options', options);
const editor = this.editor;
editor.setOption('mode', mode.mime);
this.helper.lint(editor, mode.mode);
set(this, 'mode', mode);
const editor = this.editor;
editor.setOption('mode', mode.mime);
this.helper.lint(editor, mode.mode);
set(this, 'mode', mode);
}
},
willDestroyElement: function () {
this._super(...arguments);

Loading…
Cancel
Save