fix exception disposal

This commit is contained in:
pointfeev 2022-06-12 00:22:32 -05:00
parent 53a9291dbf
commit 2c9cc36334

View file

@ -68,8 +68,6 @@ internal partial class MainForm : CustomForm
try
{
checkForUpdatesResult = await updateManager.CheckForUpdatesAsync(cancellationTokenSource.Token);
cancellationTokenSource.Dispose();
cancellationTokenSource = null;
#if !DEBUG
if (checkForUpdatesResult.CanUpdate)
{
@ -88,6 +86,11 @@ internal partial class MainForm : CustomForm
#else
catch { }
#endif
finally
{
cancellationTokenSource.Dispose();
cancellationTokenSource = null;
}
}
if (latestVersion is null)
{
@ -203,6 +206,11 @@ internal partial class MainForm : CustomForm
#else
catch { }
#endif
finally
{
cancellationTokenSource.Dispose();
cancellationTokenSource = null;
}
if (updateManager is not null && updateManager.IsUpdatePrepared(latestVersion))
{