diff options
| author | Sean Hall <r.sean.hall@gmail.com> | 2020-04-03 11:37:05 +1000 |
|---|---|---|
| committer | Sean Hall <r.sean.hall@gmail.com> | 2020-04-03 13:51:31 +1000 |
| commit | 37356647817b72a336eeedaa7472e268a04054c8 (patch) | |
| tree | d44da85954ac822188a571ce4ce0bb86a60684bb /src | |
| parent | 7027e259b8987e425362ee8248e5d0efe8003d51 (diff) | |
| download | wix-37356647817b72a336eeedaa7472e268a04054c8.tar.gz wix-37356647817b72a336eeedaa7472e268a04054c8.tar.bz2 wix-37356647817b72a336eeedaa7472e268a04054c8.zip | |
Refactor dispose into finally to make debugging easier.
Diffstat (limited to 'src')
| -rw-r--r-- | src/WixToolset.Core.WindowsInstaller/MsiBackend.cs | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/WixToolset.Core.WindowsInstaller/MsiBackend.cs b/src/WixToolset.Core.WindowsInstaller/MsiBackend.cs index 778720b9..cbd58381 100644 --- a/src/WixToolset.Core.WindowsInstaller/MsiBackend.cs +++ b/src/WixToolset.Core.WindowsInstaller/MsiBackend.cs | |||
| @@ -26,6 +26,7 @@ namespace WixToolset.Core.WindowsInstaller | |||
| 26 | var validator = Validator.CreateFromContext(context, "darice.cub"); | 26 | var validator = Validator.CreateFromContext(context, "darice.cub"); |
| 27 | 27 | ||
| 28 | IBindResult result = null; | 28 | IBindResult result = null; |
| 29 | var dispose = true; | ||
| 29 | try | 30 | try |
| 30 | { | 31 | { |
| 31 | var command = new BindDatabaseCommand(context, backendExtensions, validator); | 32 | var command = new BindDatabaseCommand(context, backendExtensions, validator); |
| @@ -36,12 +37,15 @@ namespace WixToolset.Core.WindowsInstaller | |||
| 36 | extension.PostBackendBind(result); | 37 | extension.PostBackendBind(result); |
| 37 | } | 38 | } |
| 38 | 39 | ||
| 40 | dispose = false; | ||
| 39 | return result; | 41 | return result; |
| 40 | } | 42 | } |
| 41 | catch | 43 | finally |
| 42 | { | 44 | { |
| 43 | result?.Dispose(); | 45 | if (dispose) |
| 44 | throw; | 46 | { |
| 47 | result?.Dispose(); | ||
| 48 | } | ||
| 45 | } | 49 | } |
| 46 | } | 50 | } |
| 47 | 51 | ||
