Cancel on exit

This commit is contained in:
Malte Rosenbjerg 2020-10-25 18:23:55 +01:00
parent 26f5b0f4f4
commit 31685da18a

View file

@ -55,6 +55,7 @@ void OnCancelEvent(object sender, EventArgs args)
cancellationTokenSource.Cancel();
}
CancelEvent += OnCancelEvent;
instance.Exited += delegate { cancellationTokenSource.Cancel(); };
_ffMpegArguments.Pre();
try
@ -128,7 +129,6 @@ private Instance PrepareInstance(out CancellationTokenSource cancellationTokenSo
FFMpegHelper.RootExceptionCheck();
FFMpegHelper.VerifyFFMpegExists();
var instance = new Instance(FFMpegOptions.Options.FFmpegBinary(), _ffMpegArguments.Text);
instance.DataReceived += OutputData;
cancellationTokenSource = new CancellationTokenSource();
if (_onTimeProgress != null || (_onPercentageProgress != null && _totalTimespan != null))