ZE FusionBot v8.0.1
Fixed More Memory Leaks I Missed in Previous Commit
Thanks to @link2026 & @NexusRisen
v8.0.1
BotSource.cs
- Class now implements IDisposable.
- Stop() captures the current CancellationTokenSource in a local, swaps in the new one, then disposes the old one in
the HardStop continuation. No more leak on stop/start cycle. - Dispose(bool disposing) is protected virtual so RecoverableBotSource can chain to it.
RecoverableBotSource.cs
- No longer redundantly declares IDisposable (inherits it now).
- Dispose(bool) is protected override and calls base.Dispose(disposing) so the base CTS gets cleaned up.
BotRunner.cs
- Remove(...) now disposes the BotSource after removing it from the list.
SysCord.cs
- Class implements IDisposable.
- _services re-typed from IServiceProvider → ServiceProvider and disposed.
- DM relay now stored in _dmRelayService field instead of _ = new DMRelayService(...), and disposed.
- The previously-anonymous Disconnected lambda is now a Client_Disconnected method so it can be -='d.
- Per-bot ConnectionSuccess / ConnectionError lambdas are captured into a _tradeBotUnsubscribers list and unsubscribed
on dispose. - Dispose() unsubscribes every Discord/Commands/Interactions handler (Log, PresenceUpdated, Disconnected, both Ready
handlers, MessageReceived, InteractionCreated) and disposes _dmRelayService, _services, _reconnectCts,
_reconnectSemaphore, and _client. - MainAsync's finally now delegates cleanup to Dispose() rather than disposing things piecemeal.