Fixed #149: Memory leak when switching mode from/to `code` mode, web worker of Ace editor wasn't cleaned up

This commit is contained in:
jos 2015-12-21 13:42:27 +01:00
parent 0b3b23e92e
commit 75dd0821db
2 changed files with 8 additions and 0 deletions

View File

@ -6,6 +6,8 @@ https://github.com/josdejong/jsoneditor
## not yet released, version 4.2.2 ## not yet released, version 4.2.2
- Replaced the PNG icon images with SVG. Thanks @1j01. - Replaced the PNG icon images with SVG. Thanks @1j01.
- Fixed #149: Memory leak when switching mode from/to `code` mode, web worker
of Ace editor wasn't cleaned up.
- Fixed #234: Remove dependency on a fork of the `jsonlint` project on github. - Fixed #234: Remove dependency on a fork of the `jsonlint` project on github.
- Fixed: disabled `Ctrl+L` quick key to go to a line, instead use the default - Fixed: disabled `Ctrl+L` quick key to go to a line, instead use the default
browser behavior of selecting the address bar. browser behavior of selecting the address bar.

View File

@ -218,6 +218,12 @@ textmode._onKeyDown = function (event) {
* @private * @private
*/ */
textmode._delete = function () { textmode._delete = function () {
// remove old ace editor
if (this.editor) {
this.editor.destroy();
console.log('destroy');
}
if (this.frame && this.container && this.frame.parentNode == this.container) { if (this.frame && this.container && this.frame.parentNode == this.container) {
this.container.removeChild(this.frame); this.container.removeChild(this.frame);
} }