diff options
| author | JP Dillingham <jp@dillingham.me> | 2025-07-11 17:48:44 -0500 |
|---|---|---|
| committer | JP Dillingham <jp@dillingham.me> | 2025-07-11 17:48:44 -0500 |
| commit | 3ccc23f23d8604674690db1996c0922e2e255180 (patch) | |
| tree | f80428cc88268624478b67deb695993ce5ddd38f /src | |
| parent | 187510e6418a500fbf99ff0765ef2794100bf06a (diff) | |
| download | slskd-3ccc23f23d8604674690db1996c0922e2e255180.tar.gz | |
prevent throwing during finalization
Diffstat (limited to 'src')
| -rw-r--r-- | src/slskd/Core/ConnectionWatchdog.cs | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/src/slskd/Core/ConnectionWatchdog.cs b/src/slskd/Core/ConnectionWatchdog.cs index 9964514b..5001f024 100644 --- a/src/slskd/Core/ConnectionWatchdog.cs +++ b/src/slskd/Core/ConnectionWatchdog.cs @@ -233,7 +233,18 @@ namespace slskd } finally { - CancellationTokenSource?.Dispose(); + var cts = CancellationTokenSource; + CancellationTokenSource = null; + + try + { + cts?.Dispose(); + } + catch (Exception) + { + // noop. i don't think this can throw, but if we fail to release the SyncRoot we'll be in trouble. + } + SyncRoot.Release(); } } |
