mirror of
https://github.com/Tyrrrz/DiscordChatExporter.git
synced 2025-06-04 00:28:52 -04:00
Ignore race conditions when closing dialogs
This commit is contained in:
parent
7d458cd3fd
commit
4edcdf0955
1 changed files with 9 additions and 1 deletions
|
@ -26,8 +26,16 @@ public class DialogManager : IDisposable
|
||||||
void OnDialogOpened(object? openSender, DialogOpenedEventArgs openArgs)
|
void OnDialogOpened(object? openSender, DialogOpenedEventArgs openArgs)
|
||||||
{
|
{
|
||||||
void OnScreenClosed(object? closeSender, EventArgs args)
|
void OnScreenClosed(object? closeSender, EventArgs args)
|
||||||
|
{
|
||||||
|
try
|
||||||
{
|
{
|
||||||
openArgs.Session.Close();
|
openArgs.Session.Close();
|
||||||
|
}
|
||||||
|
catch (InvalidOperationException)
|
||||||
|
{
|
||||||
|
// Race condition: dialog is already being closed
|
||||||
|
}
|
||||||
|
|
||||||
dialogScreen.Closed -= OnScreenClosed;
|
dialogScreen.Closed -= OnScreenClosed;
|
||||||
}
|
}
|
||||||
dialogScreen.Closed += OnScreenClosed;
|
dialogScreen.Closed += OnScreenClosed;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue