fix: memory leak in extension icon widget #280566
Merged
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 extension icon widget by using
addDisposableListener(this.iconElement, 'load'instead ofthis.iconElement.onload.Before
When toggling the extension search view 37 times, the number of load event listeners grows to 185:
{ "eventListenersWithStackTrace": [ { "type": "load", "description": "() => this.iconElement.style.visibility = \"inherit\"", "objectId": "4623829927015327231.1.34282", "stack": [ "listener (vscode/out/vs/workbench/contrib/extensions/browser/extensionsWidgets.js:125:36)", "ExtensionIconWidget.render (vscode/out/vs/workbench/contrib/extensions/browser/extensionsWidgets.js:126:35)", "ExtensionIconWidget.update (vscode/out/vs/workbench/contrib/extensions/browser/extensionsWidgets.js:70:10)", "set extension (vscode/out/vs/workbench/contrib/extensions/browser/extensionsWidgets.js:67:10)", "vscode/out/vs/workbench/contrib/extensions/common/extensions.js:57:48", "Array.forEach (<anonymous>)", "set extension (vscode/out/vs/workbench/contrib/extensions/common/extensions.js:57:21)", "set extension (vscode/out/vs/workbench/contrib/extensions/browser/extensionsList.js:141:39)", "Renderer.renderElement (vscode/out/vs/workbench/contrib/extensions/browser/extensionsList.js:175:20)" ], "count": 185, "originalStack": ["src/vs/workbench/contrib/extensions/browser/extensionsWidgets.ts:131:31"], "originalName": null } ]After
No more load event listener leak detected