提交 d37f7c15 编写于 作者: M Matt Bierner

Always dispose of DecorationCSSRules

Found while looking into #63467

There's potential leak for `DecorationCSSRules`. Currently we only dipose of them if `hasContent` is true, which I'm not sure guarantees that these classes are truely non-disposable

With this change, we always dispose of them. At worst, these extra dispose call should be noops
上级 02a59c30
...@@ -141,18 +141,18 @@ class DecorationTypeOptionsProvider implements IModelDecorationOptionsProvider { ...@@ -141,18 +141,18 @@ class DecorationTypeOptionsProvider implements IModelDecorationOptionsProvider {
this.refCount = 0; this.refCount = 0;
this._disposables = []; this._disposables = [];
let createCSSRules = (type: ModelDecorationCSSRuleType) => { const createCSSRules = (type: ModelDecorationCSSRuleType) => {
let rules = new DecorationCSSRules(type, providerArgs, themeService); const rules = new DecorationCSSRules(type, providerArgs, themeService);
this._disposables.push(rules);
if (rules.hasContent) { if (rules.hasContent) {
this._disposables.push(rules);
return rules.className; return rules.className;
} }
return void 0; return void 0;
}; };
let createInlineCSSRules = (type: ModelDecorationCSSRuleType) => { const createInlineCSSRules = (type: ModelDecorationCSSRuleType) => {
let rules = new DecorationCSSRules(type, providerArgs, themeService); const rules = new DecorationCSSRules(type, providerArgs, themeService);
this._disposables.push(rules);
if (rules.hasContent) { if (rules.hasContent) {
this._disposables.push(rules);
return { className: rules.className, hasLetterSpacing: rules.hasLetterSpacing }; return { className: rules.className, hasLetterSpacing: rules.hasLetterSpacing };
} }
return null; return null;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册