diff options
| author | evan314159 <110177090+evan314159@users.noreply.github.com> | 2025-09-16 17:14:52 +0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-09-16 11:14:52 +0200 |
| commit | 2618a5fba23432c89882bf343f481f4248ae7ab3 (patch) | |
| tree | 43b1e2a543fa1777c728d97e0e735414738cac06 /MediaBrowser.MediaEncoding/Subtitles | |
| parent | 2ee887a5021d9be00948366a9d7c9dc42ca0e2a4 (diff) | |
Fix sync disposal of async-created IAsyncDisposable objects (#14755)
Diffstat (limited to 'MediaBrowser.MediaEncoding/Subtitles')
| -rw-r--r-- | MediaBrowser.MediaEncoding/Subtitles/SubtitleEncoder.cs | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/MediaBrowser.MediaEncoding/Subtitles/SubtitleEncoder.cs b/MediaBrowser.MediaEncoding/Subtitles/SubtitleEncoder.cs index 359927d4d..6408f81ac 100644 --- a/MediaBrowser.MediaEncoding/Subtitles/SubtitleEncoder.cs +++ b/MediaBrowser.MediaEncoding/Subtitles/SubtitleEncoder.cs @@ -169,7 +169,8 @@ namespace MediaBrowser.MediaEncoding.Subtitles { if (fileInfo.IsExternal) { - using (var stream = await GetStream(fileInfo.Path, fileInfo.Protocol, cancellationToken).ConfigureAwait(false)) + var stream = await GetStream(fileInfo.Path, fileInfo.Protocol, cancellationToken).ConfigureAwait(false); + await using (stream.ConfigureAwait(false)) { var result = await CharsetDetector.DetectFromStreamAsync(stream, cancellationToken).ConfigureAwait(false); var detected = result.Detected; @@ -937,7 +938,8 @@ namespace MediaBrowser.MediaEncoding.Subtitles .ConfigureAwait(false); } - using (var stream = await GetStream(path, mediaSource.Protocol, cancellationToken).ConfigureAwait(false)) + var stream = await GetStream(path, mediaSource.Protocol, cancellationToken).ConfigureAwait(false); + await using (stream.ConfigureAwait(false)) { var result = await CharsetDetector.DetectFromStreamAsync(stream, cancellationToken).ConfigureAwait(false); var charset = result.Detected?.EncodingName ?? string.Empty; |
