OSDN Git Service

WinGui:
authorsr55 <sr55@b64f7644-9d1e-0410-96f1-a4d463321fa5>
Tue, 9 Nov 2010 18:02:22 +0000 (18:02 +0000)
committersr55 <sr55@b64f7644-9d1e-0410-96f1-a4d463321fa5>
Tue, 9 Nov 2010 18:02:22 +0000 (18:02 +0000)
- Don't display an exception after the process was deliberately killed.

git-svn-id: svn://localhost/HandBrake/trunk@3666 b64f7644-9d1e-0410-96f1-a4d463321fa5

win/C#/HandBrake.ApplicationServices/Services/Encode.cs

index e4c0979..3e0e31e 100644 (file)
@@ -109,6 +109,8 @@ namespace HandBrake.ApplicationServices.Services
         /// </summary>\r
         protected Process HbProcess { get; set; }\r
 \r
+        private bool processKilled;\r
+\r
         /// <summary>\r
         /// Gets a value indicating whether IsEncoding.\r
         /// </summary>\r
@@ -242,7 +244,11 @@ namespace HandBrake.ApplicationServices.Services
         {\r
             try\r
             {\r
-                if (this.HbProcess != null && !this.HbProcess.HasExited) this.HbProcess.Kill();\r
+                if (this.HbProcess != null && !this.HbProcess.HasExited)\r
+                {\r
+                    processKilled = true;\r
+                    this.HbProcess.Kill();\r
+                }\r
             }\r
             catch (Exception exc)\r
             {\r
@@ -330,7 +336,7 @@ namespace HandBrake.ApplicationServices.Services
         /// </param>\r
         private void HbProcess_Exited(object sender, EventArgs e)\r
         {\r
-            if (HbProcess != null && HbProcess.HasExited && HbProcess.ExitCode != 0)\r
+            if (HbProcess != null && HbProcess.HasExited && HbProcess.ExitCode != 0 && !processKilled)\r
             {\r
                 errorService.ShowError("It appears that HandBrakeCLI has crashed. You can check the Activity Log for further information.", string.Format("Exit Code was: {0}", HbProcess.ExitCode));\r
             }\r