Make sure we don't crash if the slice is canceled and there is an error disposing it.

issue: MatterHackers/MCCentral#5929
InvalidOperationException: No process is associated with this object.
This commit is contained in:
Lars Brubaker 2020-07-02 13:48:49 -07:00
parent 6ef6503b94
commit f5015d1cd6

View file

@ -452,8 +452,16 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
{
if (cancellationToken.IsCancellationRequested)
{
slicerProcess?.Kill();
slicerProcess?.Dispose();
// If for some reason we cannot kill the slicing process do not exit
try
{
slicerProcess?.Kill();
slicerProcess?.Dispose();
}
catch
{
}
forcedExit = true;
}