Browse Source

fix unit test.

pull/9562/head
Dan Walmsley 4 years ago
parent
commit
4a490694a2
  1. 43
      src/Avalonia.Controls/Window.cs

43
src/Avalonia.Controls/Window.cs

@ -567,30 +567,39 @@ namespace Avalonia.Controls
/// </summary> /// </summary>
public override void Hide() public override void Hide()
{ {
if (!_shown) try
{ {
return; IgnoreVisibilityChange = true;
}
if (!_shown)
{
return;
}
Renderer?.Stop(); Renderer?.Stop();
if (Owner is Window owner) if (Owner is Window owner)
{ {
owner.RemoveChild(this); owner.RemoveChild(this);
} }
if (_children.Count > 0) if (_children.Count > 0)
{
foreach (var child in _children.ToArray())
{ {
child.child.Hide(); foreach (var child in _children.ToArray())
{
child.child.Hide();
}
} }
}
Owner = null; Owner = null;
PlatformImpl?.Hide(); PlatformImpl?.Hide();
IsVisible = false; IsVisible = false;
_shown = false; _shown = false;
}
finally
{
IgnoreVisibilityChange = false;
}
} }
/// <summary> /// <summary>

Loading…
Cancel
Save