fix: prevent TextEditor disposed warnings by adding proper disposal checks #5958
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 #5954
Problem
The extension was generating frequent "TextEditor is closed/disposed" warnings (tens per second) during API actions. This was caused by DecorationController and DiffViewProvider attempting to access TextEditor instances after they had been disposed.
Solution
isDisposed
flag anddispose()
method to DecorationController to track disposal stateisEditorValid()
checks before accessing any TextEditor methodsDiffViewProvider.reset()
to clean up resourcesvisibleTextEditors
may be emptyChanges
Testing
This ensures that once an editor is closed/disposed, it is not accessed again, eliminating the warning spam.
Important
Adds disposal checks and validation for
TextEditor
instances inDecorationController.ts
andDiffViewProvider.ts
to prevent frequent warnings.isDisposed
flag anddispose()
method toDecorationController
to track disposal state.isEditorValid()
checks inDecorationController
andDiffViewProvider
to validateTextEditor
instances before operations.DiffViewProvider.reset()
to clean up resources.DecorationController.ts
: Implements disposal tracking and validation checks before editor operations.DiffViewProvider.ts
: Adds editor validation checks and ensures proper cleanup of decoration controllers.This description was created by
for ef85e6e. You can customize this summary. It will automatically update as commits are pushed.