Browse Source

Trying to add workaround for crash #1580 (top crash in 4.0 RC2, reproduction steps unknown).

pull/14/head
Daniel Grunwald 15 years ago
parent
commit
ea5e4470ac
  1. 8
      src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/CodeCompletion/CompletionWindowBase.cs

8
src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/CodeCompletion/CompletionWindowBase.cs

@ -159,6 +159,11 @@ namespace ICSharpCode.AvalonEdit.CodeCompletion @@ -159,6 +159,11 @@ namespace ICSharpCode.AvalonEdit.CodeCompletion
void TextViewScrollOffsetChanged(object sender, EventArgs e)
{
// Workaround for crash #1580 (reproduction steps unknown):
// NullReferenceException in System.Windows.Window.CreateSourceWindow()
if (!sourceIsInitialized)
return;
IScrollInfo scrollInfo = this.TextArea.TextView;
Rect visibleRect = new Rect(scrollInfo.HorizontalOffset, scrollInfo.VerticalOffset, scrollInfo.ViewportWidth, scrollInfo.ViewportHeight);
// close completion window when the user scrolls so far that the anchor position is leaving the visible area
@ -257,6 +262,8 @@ namespace ICSharpCode.AvalonEdit.CodeCompletion @@ -257,6 +262,8 @@ namespace ICSharpCode.AvalonEdit.CodeCompletion
}
}
bool sourceIsInitialized;
/// <inheritdoc/>
protected override void OnSourceInitialized(EventArgs e)
{
@ -267,6 +274,7 @@ namespace ICSharpCode.AvalonEdit.CodeCompletion @@ -267,6 +274,7 @@ namespace ICSharpCode.AvalonEdit.CodeCompletion
} else {
SetPosition(this.TextArea.Caret.Position);
}
sourceIsInitialized = true;
}
/// <inheritdoc/>

Loading…
Cancel
Save