Skip to content

Commit d8f8dad

Browse files
Clear out our projection buffers when we shutdown the preview window to workaround an editor bug.
1 parent 3fead24 commit d8f8dad

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/EditorFeatures/Core/Implementation/Preview/PreviewFactoryService.cs

+9
Original file line numberDiff line numberDiff line change
@@ -573,6 +573,15 @@ private async Task<object> CreateNewDifferenceViewerAsync(
573573

574574
diffViewer.Closed += (s, e) =>
575575
{
576+
// Workaround Editor bug. The editor has an issue where they sometimes crash when
577+
// trying to apply changes to projection buffer. So, when the user actually invokes
578+
// a SuggestedAction we may then edit a text buffer, which the editor will then
579+
// try to propagate through the projections we have here over that buffer. To ensure
580+
// that that doesn't happen, we clear out the projections first so that this crash
581+
// won't happen.
582+
originalBuffer.DeleteSpans(0, originalBuffer.CurrentSnapshot.SpanCount);
583+
changedBuffer.DeleteSpans(0, changedBuffer.CurrentSnapshot.SpanCount);
584+
576585
leftWorkspace?.Dispose();
577586
leftWorkspace = null;
578587

0 commit comments

Comments
 (0)