Skip to content

Commit

Permalink
i'm not even sure how this fixes the stutters
Browse files Browse the repository at this point in the history
  • Loading branch information
not-nullptr committed Sep 28, 2024
1 parent 7ade552 commit 1c9e7ea
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions Aerochat/Windows/Chat.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -465,12 +465,15 @@ public void RefreshChannelList()

protected override void OnClosing(CancelEventArgs e)
{
base.OnClosing(e);
// disconnect from the chat
if (Channel.Guild?.Channels.Select(x => x.Key).ToList().Contains(VoiceManager.Instance.Channel?.Id ?? 0) ?? false)
try
{
_ = VoiceManager.Instance.LeaveVoiceChannel();
if (Channel.Guild?.Channels?.Select(x => x.Key).ToList().Contains(VoiceManager.Instance.Channel?.Id ?? 0) ?? false)
{
Task.Run(VoiceManager.Instance.LeaveVoiceChannel);
}
}
catch (Exception) { }
base.OnClosing(e);
Discord.Client.TypingStarted -= OnType;
Discord.Client.MessageCreated -= OnMessageCreation;
// dispose of the chat
Expand All @@ -484,7 +487,7 @@ protected override void OnClosing(CancelEventArgs e)
timers.Clear();
chatSoundPlayer.Stop();
chatSoundPlayer.Close();
System.Timers.Timer timer = new(100);
System.Timers.Timer timer = new(2000);
timer.Elapsed += GCRelease;
timer.Start();
}
Expand Down

0 comments on commit 1c9e7ea

Please sign in to comment.