fix: memory leak in linkDetector#280204
Merged
connor4312 merged 25 commits intomicrosoft:mainfrom Jan 8, 2026
Merged
Conversation
rzhao271
previously approved these changes
Dec 15, 2025
Member
|
Build error: |
auto-merge was automatically disabled
December 16, 2025 15:33
Head branch was pushed to by a user without write access
38fda63
Member
|
thanks! |
connor4312
previously approved these changes
Dec 16, 2025
Member
|
Looks like something in the tests might be missing a disposable check 😬 |
joaomoreno
previously approved these changes
Dec 16, 2025
auto-merge was automatically disabled
December 16, 2025 16:57
Head branch was pushed to by a user without write access
c766088
Contributor
Author
|
Thanks!
/* Since this is async. when the promise resolves, the store might be disposed */
this.fileService.stat(uri).then(stat => {
if (stat.isDirectory) {
return;
}
this.decorateLink(link, uri, fulltext, hoverBehavior, (preserveFocus: boolean) => this.editorService.openEditor({ resource: uri, options: { ...options, preserveFocus } }));
} |
Tyriar
previously approved these changes
Jan 7, 2026
Contributor
|
Red CI |
Contributor
|
Also this is on Jan but had auto merge enabled |
Contributor
Author
|
Fixed missing semicolons. Now it really should work. |
connor4312
approved these changes
Jan 7, 2026
Member
|
@microsoft-github-policy-service rerun |
bpasero
approved these changes
Jan 8, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes a memory leak in
linkDetector.tsby replacingHTMLElement.onclickwithdom.addDisposableListener('click').Because of that, now the disposable store also needs to be passed from one function to another and another. But the main change is replacing
HTMLElement.onclickwithdom.addDisposableListener('click').Test Results
Before
A
keydown,click,mouseleaveandmousemoveevent listener leak related tolinkDetectorare found:{ "eventListenersWithStackTrace": [ { "type": "keydown", "description": "l=>{const c=new Li(l);(c.keyCode===3||c.keyCode===10)&&(c.preventDefault(),c.stopPropagation(),r(c.keyCode===10))}", "objectId": "-6136671504294265107.1.22263", "count": 133, "originalStack": ["src/vs/workbench/contrib/debug/browser/linkDetector.ts:338:19"], "originalName": "e" }, { "type": "click", "description": "l=>{const c=Te(e).getSelection();!c||c.type===\"Range\"||(Ye?l.metaKey:l.ctrlKey)&&(l.preventDefault(),l.stopImmediatePropagation(),r(!1))}", "objectId": "-6136671504294265107.1.22261", "count": 133, "originalStack": ["src/vs/workbench/contrib/debug/browser/linkDetector.ts:325:18"], "originalName": "event" }, { "type": "mouseleave", "description": "()=>e.classList.remove(\"pointer\")", "objectId": "-6136671504294265107.1.22259", "count": 133, "originalStack": ["src/vs/workbench/contrib/debug/browser/linkDetector.ts:324:22"], "originalName": null }, { "type": "mousemove", "description": "l=>{e.classList.toggle(\"pointer\",Ye?l.metaKey:l.ctrlKey)}", "objectId": "-6136671504294265107.1.22257", "count": 133, "originalStack": ["src/vs/workbench/contrib/debug/browser/linkDetector.ts:323:22"], "originalName": "event" } ], "isLeak": true }After
No more leak is detected.