Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fix null reference when completion window closed and completion list …

…selection changed event fired afterwards.
  • Loading branch information...
commit 996193282c1a871122ee0e401565575a44322f85 1 parent 2f53cc6
Matt Ward mrward authored
6 src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/CodeCompletion/CompletionWindow.cs
View
@@ -48,8 +48,6 @@ public CompletionWindow(TextArea textArea) : base(textArea)
toolTip.Placement = PlacementMode.Right;
toolTip.Closed += toolTip_Closed;
- completionList.InsertionRequested += completionList_InsertionRequested;
- completionList.SelectionChanged += completionList_SelectionChanged;
AttachEvents();
}
@@ -98,6 +96,8 @@ void completionList_InsertionRequested(object sender, EventArgs e)
void AttachEvents()
{
+ this.completionList.InsertionRequested += completionList_InsertionRequested;
+ this.completionList.SelectionChanged += completionList_SelectionChanged;
this.TextArea.Caret.PositionChanged += CaretPositionChanged;
this.TextArea.MouseWheel += textArea_MouseWheel;
this.TextArea.PreviewTextInput += textArea_PreviewTextInput;
@@ -106,6 +106,8 @@ void AttachEvents()
/// <inheritdoc/>
protected override void DetachEvents()
{
+ this.completionList.InsertionRequested -= completionList_InsertionRequested;
+ this.completionList.SelectionChanged -= completionList_SelectionChanged;
this.TextArea.Caret.PositionChanged -= CaretPositionChanged;
this.TextArea.MouseWheel -= textArea_MouseWheel;
this.TextArea.PreviewTextInput -= textArea_PreviewTextInput;
Please sign in to comment.
Something went wrong with that request. Please try again.