diff options
author | sr55 <[email protected]> | 2019-02-16 18:04:49 +0000 |
---|---|---|
committer | sr55 <[email protected]> | 2019-02-16 18:04:49 +0000 |
commit | ce660242a4ad016cccbe51cd4cf1f402cb14bb44 (patch) | |
tree | cfd15f5427e07465c509d1f31151d1d6228afb01 /win/CS | |
parent | 742e968437b978e1e8a280bf4901ef4787ea94fc (diff) |
WinGui: Add HandleProcessCorruptedStateExceptions around Init.
Diffstat (limited to 'win/CS')
-rw-r--r-- | win/CS/HandBrake.Interop/Interop/HandBrakeUtils.cs | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/win/CS/HandBrake.Interop/Interop/HandBrakeUtils.cs b/win/CS/HandBrake.Interop/Interop/HandBrakeUtils.cs index 7f36a406c..9c499c9c5 100644 --- a/win/CS/HandBrake.Interop/Interop/HandBrakeUtils.cs +++ b/win/CS/HandBrake.Interop/Interop/HandBrakeUtils.cs @@ -13,6 +13,7 @@ namespace HandBrake.Interop.Interop using System.Collections.Generic; using System.Linq.Expressions; using System.Runtime.CompilerServices; + using System.Runtime.ExceptionServices; using System.Runtime.InteropServices; using HandBrake.Interop.Interop.EventArgs; @@ -64,11 +65,7 @@ namespace HandBrake.Interop.Interop { try { - - if (HBFunctions.hb_global_init() == -1) - { - throw new InvalidOperationException("HB global init failed."); - } + TryInit(); } catch (Exception e) { @@ -88,6 +85,15 @@ namespace HandBrake.Interop.Interop } } + [HandleProcessCorruptedStateExceptions] + static void TryInit() + { + if (HBFunctions.hb_global_init() == -1) + { + throw new InvalidOperationException("HB global init failed."); + } + } + /// <summary> /// Ensures the HB global initialize method has been called. /// </summary> |