mirror of
https://github.com/jellyfin/jellyfin.git
synced 2025-07-09 03:04:24 -04:00
Make sure Process objects are all disposed correctly
This commit is contained in:
parent
b947d98266
commit
7447ea8960
@ -289,6 +289,8 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
|
||||
/// Processes the exited.
|
||||
/// </summary>
|
||||
private void OnFfMpegProcessExited(Process process, string inputFile)
|
||||
{
|
||||
try
|
||||
{
|
||||
_hasExited = true;
|
||||
|
||||
@ -314,6 +316,11 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
|
||||
exitCode)));
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
process.Dispose();
|
||||
}
|
||||
}
|
||||
|
||||
private async void StartStreamingLog(Stream source, Stream target)
|
||||
{
|
||||
|
@ -436,6 +436,7 @@ namespace MediaBrowser.MediaEncoding.Subtitles
|
||||
ErrorDialog = false
|
||||
};
|
||||
var process = new Process { StartInfo = processStartInfo, EnableRaisingEvents = true };
|
||||
process.Exited += (sender, args) => ((Process)sender).Dispose();
|
||||
|
||||
_logger.LogInformation("{0} {1}", process.StartInfo.FileName, process.StartInfo.Arguments);
|
||||
|
||||
@ -468,8 +469,6 @@ namespace MediaBrowser.MediaEncoding.Subtitles
|
||||
|
||||
var exitCode = ranToCompletion ? process.ExitCode : -1;
|
||||
|
||||
process.Dispose();
|
||||
|
||||
var failed = false;
|
||||
|
||||
if (exitCode == -1)
|
||||
@ -585,6 +584,7 @@ namespace MediaBrowser.MediaEncoding.Subtitles
|
||||
ErrorDialog = false
|
||||
};
|
||||
var process = new Process { StartInfo = processStartInfo, EnableRaisingEvents = true };
|
||||
process.Exited += (sender, args) => ((Process)sender).Dispose();
|
||||
|
||||
_logger.LogInformation("{File} {Arguments}", process.StartInfo.FileName, process.StartInfo.Arguments);
|
||||
|
||||
@ -617,8 +617,6 @@ namespace MediaBrowser.MediaEncoding.Subtitles
|
||||
|
||||
var exitCode = ranToCompletion ? process.ExitCode : -1;
|
||||
|
||||
process.Dispose();
|
||||
|
||||
var failed = false;
|
||||
|
||||
if (exitCode == -1)
|
||||
|
Loading…
x
Reference in New Issue
Block a user