diff options
author | Marius Ungureanu <marius.ungureanu@xamarin.com> | 2017-12-06 09:14:05 +0300 |
---|---|---|
committer | Marius Ungureanu <marius.ungureanu@xamarin.com> | 2017-12-06 09:14:05 +0300 |
commit | 91741f4aef9f863253a56fcf54ea7528ccbe4f85 (patch) | |
tree | 2da97bc0f7fb33fe45e054dfb0a89bdb53f14dfd /src | |
parent | 1eab72976996a66584344409a4166ccc77805f7c (diff) |
[Undo] Fix leaks of the whole undo stack for a document
Diffstat (limited to 'src')
-rw-r--r-- | src/Text/Impl/EditorOperations/EditorOperations.cs | 5 | ||||
-rw-r--r-- | src/Text/Impl/TextBufferUndoManager/TextBufferUndoManager.cs | 1 |
2 files changed, 6 insertions, 0 deletions
diff --git a/src/Text/Impl/EditorOperations/EditorOperations.cs b/src/Text/Impl/EditorOperations/EditorOperations.cs index a820321..50582ff 100644 --- a/src/Text/Impl/EditorOperations/EditorOperations.cs +++ b/src/Text/Impl/EditorOperations/EditorOperations.cs @@ -113,6 +113,11 @@ namespace Microsoft.VisualStudio.Text.Operations.Implementation _editorOptions = factory.EditorOptionsProvider.GetOptions(textView); _factory.TextDocumentFactoryService.TryGetTextDocument(_textView.TextDataModel.DocumentBuffer, out _textDocument); + + _textView.Closed += delegate { + _factory.UndoHistoryRegistry.RemoveHistory(_undoHistory); + _factory.TextBufferUndoManagerProvider.RemoveTextBufferUndoManager(_textView.TextBuffer); + }; } diff --git a/src/Text/Impl/TextBufferUndoManager/TextBufferUndoManager.cs b/src/Text/Impl/TextBufferUndoManager/TextBufferUndoManager.cs index 9fe2e37..77f526c 100644 --- a/src/Text/Impl/TextBufferUndoManager/TextBufferUndoManager.cs +++ b/src/Text/Impl/TextBufferUndoManager/TextBufferUndoManager.cs @@ -192,6 +192,7 @@ namespace Microsoft.VisualStudio.Text.BufferUndoManager.Implementation public void Dispose() { + UnregisterUndoHistory(); _textBuffer.Changed -= TextBufferChanged; _textBuffer.PostChanged -= TextBufferPostChanged; _textBuffer.Changing -= TextBufferChanging; |