Skip to content

Commit

Permalink
remove observer when destroying font_metrics
Browse files Browse the repository at this point in the history
  • Loading branch information
nightwing committed Jul 22, 2018
1 parent 85b4c97 commit bac154e
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 9 deletions.
1 change: 0 additions & 1 deletion lib/ace/ext/static_highlight.js
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,6 @@ highlight.renderSync = function(input, mode, theme, lineStart, disableGutter) {
//console.log(JSON.stringify(outerEl, null, 2));
//console.log(outerEl.toString());
outerEl.appendChild(innerEl);
textLayer.destroy();

return {
css: baseStyles + theme.cssText,
Expand Down
2 changes: 2 additions & 0 deletions lib/ace/layer/font_metrics.js
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,8 @@ var FontMetrics = exports.FontMetrics = function(parentEl) {

this.destroy = function() {
clearInterval(this.$pollSizeChangesTimer);
if (this.$observer)
this.$observer.disconnect();
if (this.el && this.el.parentNode)
this.el.parentNode.removeChild(this.el);
};
Expand Down
8 changes: 1 addition & 7 deletions lib/ace/layer/text.js
Original file line number Diff line number Diff line change
Expand Up @@ -635,13 +635,7 @@ var Text = function(parentEl) {
return this.session.getUseWrapMode();
};

this.destroy = function() {
clearInterval(this.$pollSizeChangesTimer);
if (this.$measureNode)
this.$measureNode.parentNode.removeChild(this.$measureNode);
delete this.$measureNode;
};

this.destroy = function() {};
}).call(Text.prototype);

exports.Text = Text;
Expand Down
2 changes: 1 addition & 1 deletion lib/ace/virtual_renderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -1659,7 +1659,7 @@ var VirtualRenderer = function(container, theme) {
* Destroys the text and cursor layers for this renderer.
**/
this.destroy = function() {
this.$textLayer.destroy();
this.$fontMetrics.destroy();
this.$cursorLayer.destroy();
};

Expand Down

0 comments on commit bac154e

Please sign in to comment.