diff --git a/HISTORY.md b/HISTORY.md index 6924458..2b249c8 100644 --- a/HISTORY.md +++ b/HISTORY.md @@ -6,6 +6,8 @@ https://github.com/josdejong/jsoneditor ## not yet released, version 4.2.2 - 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: disabled `Ctrl+L` quick key to go to a line, instead use the default browser behavior of selecting the address bar. diff --git a/src/js/textmode.js b/src/js/textmode.js index 7b1f7ee..17a4247 100644 --- a/src/js/textmode.js +++ b/src/js/textmode.js @@ -218,6 +218,12 @@ textmode._onKeyDown = function (event) { * @private */ 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) { this.container.removeChild(this.frame); }