From d774ff8bc15bd549caee73bc2b149b13df84d262 Mon Sep 17 00:00:00 2001 From: JohnBlair Date: Fri, 18 Oct 2019 07:17:56 +0100 Subject: [PATCH] Undoing a bad previous change where logic in a catch should have been in a finally. Also dispose could throw an error so catch it and complete the clean up. --- .../PublishedCache/NuCache/ContentStore.cs | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/src/Umbraco.Web/PublishedCache/NuCache/ContentStore.cs b/src/Umbraco.Web/PublishedCache/NuCache/ContentStore.cs index 3fe4b8aecd..179b262568 100644 --- a/src/Umbraco.Web/PublishedCache/NuCache/ContentStore.cs +++ b/src/Umbraco.Web/PublishedCache/NuCache/ContentStore.cs @@ -238,11 +238,21 @@ namespace Umbraco.Web.PublishedCache.NuCache // Trying to lock could throw exceptions so always make sure to clean up. Lock(lockInfo); } - catch + catch { throw; } + finally { - if (_localDb == null) return; - _localDb.Dispose(); - _localDb = null; + if (_localDb != null) + { + try + { + _localDb.Dispose(); + } + catch { /* TBD: May already be throwing so don't throw again */} + finally + { + _localDb = null; + } + } } }