fix: prevent listener leak from duplicate status IDs in language status (#309042)#309159
Merged
jrieken merged 2 commits intomicrosoft:mainfrom Apr 17, 2026
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Fixes a listener leak in the workbench Language Status UI by preventing duplicate status IDs (within a single update pass) from creating multiple status bar entry accessors, which could orphan the earlier accessor and leak listeners.
Changes:
- Reuse an accessor already created earlier in the same
_update()cycle by checkingnewDedicatedEntriesbefore falling back tothis._dedicatedEntries. - Add a dedicated regression test suite covering duplicate-ID scenarios and mixed reuse/create/dispose behavior.
Show a summary per file
| File | Description |
|---|---|
| src/vs/workbench/contrib/languageStatus/browser/languageStatus.ts | Prevents duplicate addEntry calls for the same status ID within a single update cycle by reusing the in-flight accessor. |
| src/vs/workbench/contrib/languageStatus/test/common/languageStatusDedupe.test.ts | Adds regression coverage for duplicate dedicated status IDs to ensure accessor reuse and correct disposal behavior. |
Copilot's findings
- Files reviewed: 2/2 changed files
- Comments generated: 0
jrieken
approved these changes
Apr 17, 2026
lszomoru
approved these changes
Apr 17, 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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Fixes #309042
Bug: A listener leak was detected in
languageStatus.tsat line 280, triggered when duplicate status IDs appeared momentarily during status updates.Root Cause: In the
_update()method's dedicated entries loop, when the same status ID appeared twice during an update cycle, the code only checkedthis._dedicatedEntries(from the previous update) and not the entries already created in the current update. This caused a newaddEntrycall for a duplicate ID, leaking the previous accessor's disposable.Fix: Added a check against
newDedicatedEntries(entries already processed in the current update) before falling back tothis._dedicatedEntries, preventing duplicate entry accessor creation.Changes
src/vs/workbench/contrib/languageStatus/browser/languageStatus.ts: In the dedicated entries loop of_update(), checknewDedicatedEntriesfirst (via??) beforethis._dedicatedEntriesto catch duplicate status IDs within the same update cycle.src/vs/workbench/contrib/languageStatus/test/common/languageStatusDedupe.test.ts: Added 7 regression tests covering duplicate ID scenarios, verifying that existing accessors are reused and no extra entries are created.Testing
src/vs/workbench/contrib/languageStatus/test/common/languageStatusDedupe.test.tsthat verifies:newDedicatedEntriesmap correctly prevents duplicateaddEntrycalls