diff options
author | Mike Krüger <mkrueger@xamarin.com> | 2011-10-17 13:37:31 +0400 |
---|---|---|
committer | Mike Krüger <mkrueger@xamarin.com> | 2011-10-17 13:38:29 +0400 |
commit | a4954f61e72d18c33e4803e20105407830ad623d (patch) | |
tree | f5df26cbe8831e50bc12cd7ef85d0e4b8afeda66 /main/src/addins/VersionControl | |
parent | b6bdf024e4170f241ccd3e5a3649ad1f58cf73d4 (diff) |
[VersionControl] Fixed small memory leak.
Diffstat (limited to 'main/src/addins/VersionControl')
2 files changed, 19 insertions, 4 deletions
diff --git a/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/EditorCompareWidgetBase.cs b/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/EditorCompareWidgetBase.cs index 88a39f7aa2..ae438f8b8d 100644 --- a/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/EditorCompareWidgetBase.cs +++ b/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/EditorCompareWidgetBase.cs @@ -459,6 +459,17 @@ namespace MonoDevelop.VersionControl.Views protected override void OnDestroyed () { base.OnDestroyed (); + + if (vAdjustment != null) { + vAdjustment.Destroy (); + hAdjustment.Destroy (); + foreach (var adj in attachedVAdjustments) + adj.Destroy (); + foreach (var adj in attachedHAdjustments) + adj.Destroy (); + vAdjustment = null; + } + children.ForEach (child => child.Child.Destroy ()); } diff --git a/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/MergeWidget.cs b/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/MergeWidget.cs index a6fe912c84..9ab8a99e25 100644 --- a/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/MergeWidget.cs +++ b/main/src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl.Views/MergeWidget.cs @@ -53,6 +53,7 @@ namespace MonoDevelop.VersionControl.Views public MergeWidget () { + MainEditor.Document.TextReplaced += UpdateConflictsOnTextReplace; } protected override void UndoChange (TextEditor fromEditor, TextEditor toEditor, Hunk hunk) @@ -88,12 +89,15 @@ namespace MonoDevelop.VersionControl.Views MainEditor.Document.Text = System.IO.File.ReadAllText (fileName); this.CreateDiff (); - MainEditor.Document.TextReplaced += delegate { - this.UpdateDiff (); - }; Show (); } + protected override void OnDestroyed () + { + base.OnDestroyed (); + MainEditor.Document.TextReplaced -= UpdateConflictsOnTextReplace; + } + public string GetResultText () { return MainEditor.Text; @@ -222,7 +226,6 @@ namespace MonoDevelop.VersionControl.Views editors[2].Insert (editors[2].Document.Length, lastPart); UpdateDiff (); - MainEditor.Document.TextReplaced += UpdateConflictsOnTextReplace; } IEnumerable<ISegment> GetAllConflictingSegments () @@ -238,6 +241,7 @@ namespace MonoDevelop.VersionControl.Views void UpdateConflictsOnTextReplace (object sender, ReplaceEventArgs e) { + this.UpdateDiff (); Document.UpdateSegments (GetAllConflictingSegments (), e); } } |