mirror of https://github.com/jellyfin/jellyfin.git
Make sure Process objects are all disposed correctly
This commit is contained in:
parent
b947d98266
commit
7447ea8960
|
@ -290,9 +290,11 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private void OnFfMpegProcessExited(Process process, string inputFile)
|
private void OnFfMpegProcessExited(Process process, string inputFile)
|
||||||
{
|
{
|
||||||
_hasExited = true;
|
try
|
||||||
|
{
|
||||||
|
_hasExited = true;
|
||||||
|
|
||||||
_logFileStream?.Dispose();
|
_logFileStream?.Dispose();
|
||||||
_logFileStream = null;
|
_logFileStream = null;
|
||||||
|
|
||||||
var exitCode = process.ExitCode;
|
var exitCode = process.ExitCode;
|
||||||
|
@ -311,7 +313,12 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
|
||||||
CultureInfo.InvariantCulture,
|
CultureInfo.InvariantCulture,
|
||||||
"Recording for {0} failed. Exit code {1}",
|
"Recording for {0} failed. Exit code {1}",
|
||||||
_targetPath,
|
_targetPath,
|
||||||
exitCode)));
|
exitCode)));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
process.Dispose();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -436,6 +436,7 @@ namespace MediaBrowser.MediaEncoding.Subtitles
|
||||||
ErrorDialog = false
|
ErrorDialog = false
|
||||||
};
|
};
|
||||||
var process = new Process { StartInfo = processStartInfo, EnableRaisingEvents = true };
|
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);
|
_logger.LogInformation("{0} {1}", process.StartInfo.FileName, process.StartInfo.Arguments);
|
||||||
|
|
||||||
|
@ -468,8 +469,6 @@ namespace MediaBrowser.MediaEncoding.Subtitles
|
||||||
|
|
||||||
var exitCode = ranToCompletion ? process.ExitCode : -1;
|
var exitCode = ranToCompletion ? process.ExitCode : -1;
|
||||||
|
|
||||||
process.Dispose();
|
|
||||||
|
|
||||||
var failed = false;
|
var failed = false;
|
||||||
|
|
||||||
if (exitCode == -1)
|
if (exitCode == -1)
|
||||||
|
@ -585,6 +584,7 @@ namespace MediaBrowser.MediaEncoding.Subtitles
|
||||||
ErrorDialog = false
|
ErrorDialog = false
|
||||||
};
|
};
|
||||||
var process = new Process { StartInfo = processStartInfo, EnableRaisingEvents = true };
|
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);
|
_logger.LogInformation("{File} {Arguments}", process.StartInfo.FileName, process.StartInfo.Arguments);
|
||||||
|
|
||||||
|
@ -617,8 +617,6 @@ namespace MediaBrowser.MediaEncoding.Subtitles
|
||||||
|
|
||||||
var exitCode = ranToCompletion ? process.ExitCode : -1;
|
var exitCode = ranToCompletion ? process.ExitCode : -1;
|
||||||
|
|
||||||
process.Dispose();
|
|
||||||
|
|
||||||
var failed = false;
|
var failed = false;
|
||||||
|
|
||||||
if (exitCode == -1)
|
if (exitCode == -1)
|
||||||
|
|
Loading…
Reference in New Issue