From 4da5339379ef9b671fb6bbcee8cb4597ba9764c3 Mon Sep 17 00:00:00 2001 From: Paul Hebble Date: Sun, 5 Nov 2017 12:56:41 -0600 Subject: [PATCH 1/2] Clean up registry lock file after parse failure --- Core/Registry/RegistryManager.cs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/Core/Registry/RegistryManager.cs b/Core/Registry/RegistryManager.cs index d2ed47bca4..2f995294e8 100644 --- a/Core/Registry/RegistryManager.cs +++ b/Core/Registry/RegistryManager.cs @@ -47,7 +47,13 @@ private RegistryManager(string path, KSP ksp) throw new RegistryInUseKraken(lockfilePath); } - LoadOrCreate(); + try { + LoadOrCreate(); + } catch { + // Clean up the lock file + Dispose(false); + throw; + } // We don't cause an inconsistency error to stop the registry from being loaded, // because then the user can't do anything to correct it. However we're From 8c3332b950deae528038c4a4b594fcc3824e8d0a Mon Sep 17 00:00:00 2001 From: Paul Hebble Date: Sun, 5 Nov 2017 13:41:32 -0600 Subject: [PATCH 2/2] Conform to CKAN's curly brace positioning convention --- Core/Registry/RegistryManager.cs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/Core/Registry/RegistryManager.cs b/Core/Registry/RegistryManager.cs index 2f995294e8..754dbe13bf 100644 --- a/Core/Registry/RegistryManager.cs +++ b/Core/Registry/RegistryManager.cs @@ -47,9 +47,12 @@ private RegistryManager(string path, KSP ksp) throw new RegistryInUseKraken(lockfilePath); } - try { + try + { LoadOrCreate(); - } catch { + } + catch + { // Clean up the lock file Dispose(false); throw;