Browse Source

AvalonEdit IME support: Fix NullReferenceException when HwndSource.RootVisual == null.

Can happen during AvalonDock layout switches (http://community.sharpdevelop.net/forums/t/16326.aspx)
pull/28/head
Daniel Grunwald 13 years ago
parent
commit
3e3e7d0fce
  1. 4
      src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Editing/ImeNativeWrapper.cs

4
src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Editing/ImeNativeWrapper.cs

@ -150,7 +150,7 @@ namespace ICSharpCode.AvalonEdit.Editing @@ -150,7 +150,7 @@ namespace ICSharpCode.AvalonEdit.Editing
{
// this may happen during layout changes in AvalonDock, so we just return an empty rectangle
// in those cases. It should be refreshed immediately.
if (!source.RootVisual.IsAncestorOf(textView))
if (source.RootVisual == null || !source.RootVisual.IsAncestorOf(textView))
return EMPTY_RECT;
Rect displayRect = new Rect(0, 0, textView.ActualWidth, textView.ActualHeight);
return textView
@ -167,7 +167,7 @@ namespace ICSharpCode.AvalonEdit.Editing @@ -167,7 +167,7 @@ namespace ICSharpCode.AvalonEdit.Editing
return EMPTY_RECT;
// this may happen during layout changes in AvalonDock, so we just return an empty rectangle
// in those cases. It should be refreshed immediately.
if (!source.RootVisual.IsAncestorOf(textView))
if (source.RootVisual == null || !source.RootVisual.IsAncestorOf(textView))
return EMPTY_RECT;
TextLine line = vl.GetTextLine(pos.VisualColumn);
Rect displayRect;

Loading…
Cancel
Save