Ignore race conditions when closing dialogs

This commit is contained in:
Tyrrrz 2023-01-09 11:46:56 +02:00
parent 7d458cd3fd
commit 4edcdf0955

View file

@ -27,7 +27,15 @@ public class DialogManager : IDisposable
{
void OnScreenClosed(object? closeSender, EventArgs args)
{
openArgs.Session.Close();
try
{
openArgs.Session.Close();
}
catch (InvalidOperationException)
{
// Race condition: dialog is already being closed
}
dialogScreen.Closed -= OnScreenClosed;
}
dialogScreen.Closed += OnScreenClosed;