Self disposal
MODIFY
WalletWasabi.Gui/Program.cs
WalletWasabi.Gui/Program.cs
@@ -179,8 +179,6 @@ namespace WalletWasabi.Gui
}
Logger.LogSoftwareStopped("Wasabi");
-
- TerminateService?.Dispose();
}
private static void TaskScheduler_UnobservedTaskException(object? sender, UnobservedTaskExceptionEventArgs e)

MODIFY
WalletWasabi/Services/Terminate/TerminateService.cs
WalletWasabi/Services/Terminate/TerminateService.cs
@@ -7,7 +7,7 @@ using WalletWasabi.Logging;
namespace WalletWasabi.Services.Terminate
{
- public class TerminateService : IDisposable
+ public class TerminateService
{
private bool _disposedValue;
private Func<Task> _terminateApplicationAsync;
@@ -68,26 +68,14 @@ namespace WalletWasabi.Services.Terminate
// Indicate that the termination procedure finished. So other callers can return.
Interlocked.Exchange(ref _terminateStatus, TerminateFinished);
+ Dispose();
Environment.Exit(exitCode);
}
- protected virtual void Dispose(bool disposing)
- {
- if (!_disposedValue)
- {
- if (disposing)
+ private void Dispose()
{
AppDomain.CurrentDomain.ProcessExit -= CurrentDomain_ProcessExit;
Console.CancelKeyPress -= Console_CancelKeyPress;
- }
-
- _disposedValue = true;
- }
- }
-
- public void Dispose()
- {
- Dispose(disposing: true);
GC.SuppressFinalize(this);
}
}

Self disposal