From 327fa35f4f25925104d7634c3730b83d8f2531e5 Mon Sep 17 00:00:00 2001 From: Jordan Brown Date: Fri, 5 Oct 2018 19:56:40 -0400 Subject: [PATCH] Prevent InstanceManager.Dispose from being called twice --- .../Components/InstanceManager.cs | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/Tgstation.Server.Host/Components/InstanceManager.cs b/src/Tgstation.Server.Host/Components/InstanceManager.cs index 00b4e42e3c..88a2286d47 100644 --- a/src/Tgstation.Server.Host/Components/InstanceManager.cs +++ b/src/Tgstation.Server.Host/Components/InstanceManager.cs @@ -49,6 +49,11 @@ namespace Tgstation.Server.Host.Components /// readonly Dictionary instances; + /// + /// If the has been d + /// + bool disposed; + /// /// Construct an /// @@ -73,6 +78,12 @@ namespace Tgstation.Server.Host.Components /// public void Dispose() { + lock (this) + { + if (disposed) + return; + disposed = true; + } foreach (var I in instances) I.Value.Dispose(); }