From 602f1700915f62cf1346e30f41448bc9b1fe925e Mon Sep 17 00:00:00 2001 From: Chris Cameron Date: Fri, 20 Sep 2019 10:00:36 -0400 Subject: [PATCH] fix: Moving SafeCriticalSection Enters outside of tryf block, don't want to Leave if the Enter fails --- ICD.Common.Utils/SafeCriticalSection.cs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/ICD.Common.Utils/SafeCriticalSection.cs b/ICD.Common.Utils/SafeCriticalSection.cs index 3ffa3a9..33d5f73 100644 --- a/ICD.Common.Utils/SafeCriticalSection.cs +++ b/ICD.Common.Utils/SafeCriticalSection.cs @@ -13,9 +13,10 @@ namespace ICD.Common.Utils if (callback == null) throw new ArgumentNullException("callback"); + Enter(); + try { - Enter(); callback(); } finally @@ -35,9 +36,10 @@ namespace ICD.Common.Utils if (callback == null) throw new ArgumentNullException("callback"); + Enter(); + try { - Enter(); return callback(); } finally