diff options
author | sr55 <[email protected]> | 2020-04-09 21:07:12 +0100 |
---|---|---|
committer | sr55 <[email protected]> | 2020-04-09 21:07:12 +0100 |
commit | 0abc8cb07a4d6ca27d0a0c300a78957b610b773e (patch) | |
tree | e2a93933a6e65357a39a59d951cee44a87d8c142 /win/CS/HandBrakeWPF/Instance | |
parent | 0dcc7cf1a5c986b17bc36c7309bfad46658d05de (diff) |
WinGui: Allow the *experimental* process worker feature to be enabled though advanced preferences. When enabled, all encodes will run in a seperate worker process protecting the UI and queue from any serious crashes.
Diffstat (limited to 'win/CS/HandBrakeWPF/Instance')
-rw-r--r-- | win/CS/HandBrakeWPF/Instance/RemoteInstance.cs | 19 |
1 files changed, 8 insertions, 11 deletions
diff --git a/win/CS/HandBrakeWPF/Instance/RemoteInstance.cs b/win/CS/HandBrakeWPF/Instance/RemoteInstance.cs index dc52d0885..847e9cf4c 100644 --- a/win/CS/HandBrakeWPF/Instance/RemoteInstance.cs +++ b/win/CS/HandBrakeWPF/Instance/RemoteInstance.cs @@ -209,7 +209,7 @@ namespace HandBrakeWPF.Instance { if (this.retryCount > 5) { - this.EncodeCompleted?.Invoke(sender: this, e: new EncodeCompletedEventArgs(true)); + this.EncodeCompleted?.Invoke(sender: this, e: new EncodeCompletedEventArgs(4)); this.encodePollTimer?.Stop(); @@ -239,7 +239,7 @@ namespace HandBrakeWPF.Instance TaskState taskState = state != null ? TaskState.FromRepositoryValue(state.State) : null; - if (taskState != null && (taskState == TaskState.Working || taskState == TaskState.Muxing || taskState == TaskState.Searching)) + if (taskState != null && (taskState == TaskState.Working || taskState == TaskState.Searching)) { if (this.EncodeProgress != null) { @@ -259,15 +259,12 @@ namespace HandBrakeWPF.Instance else if (taskState != null && taskState == TaskState.WorkDone) { this.encodePollTimer.Stop(); - - this.EncodeCompleted?.Invoke(sender: this, e: new EncodeCompletedEventArgs(state.WorkDone.Error != 0)); - this.workerProcess?.Kill(); - } - else if (taskState == TaskState.Idle) - { - this.encodePollTimer.Stop(); - this.EncodeCompleted?.Invoke(sender: this, e: new EncodeCompletedEventArgs(state.WorkDone.Error != 0)); - this.workerProcess?.Kill(); + if (!this.workerProcess.HasExited) + { + this.workerProcess?.Kill(); + } + + this.EncodeCompleted?.Invoke(sender: this, e: new EncodeCompletedEventArgs(state.WorkDone.Error)); } } } |