Browse Source

Only try to close non-owned windows on shutdown.

Owned windows will be closed by their owners.
pull/6174/head
Steven Kirk 5 years ago
parent
commit
cee1a24e03
  1. 6
      src/Avalonia.Controls/ApplicationLifetimes/ClassicDesktopStyleApplicationLifetime.cs

6
src/Avalonia.Controls/ApplicationLifetimes/ClassicDesktopStyleApplicationLifetime.cs

@ -132,8 +132,12 @@ namespace Avalonia.Controls.ApplicationLifetimes
private void ShutdownRequested(object sender, CancelEventArgs e)
{
// When an OS shutdown request is received, try to close all non-owned windows. Windows can cancel
// shutdown by setting e.Cancel = true in the Closing event. Owned windows will be shutdown by their
// owners.
foreach (var w in Windows)
w.Close();
if (w.Owner is null)
w.Close();
if (Windows.Count > 0)
e.Cancel = true;
}

Loading…
Cancel
Save