From eb3045e769eb99754c6ea414590e4734df4f9683 Mon Sep 17 00:00:00 2001 From: Paul Hebble Date: Wed, 27 Sep 2023 22:52:34 -0500 Subject: [PATCH] Make tag index thread-safe --- Core/Registry/Registry.cs | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/Core/Registry/Registry.cs b/Core/Registry/Registry.cs index 5f472cdc9d..3d3c03e580 100644 --- a/Core/Registry/Registry.cs +++ b/Core/Registry/Registry.cs @@ -712,9 +712,12 @@ public Dictionary Tags { get { - if (tags == null) + lock (tagMutex) { - BuildTagIndex(); + if (tags == null) + { + BuildTagIndex(); + } } return tags; } @@ -725,14 +728,19 @@ public HashSet Untagged { get { - if (untagged == null) + lock (tagMutex) { - BuildTagIndex(); + if (untagged == null) + { + BuildTagIndex(); + } } return untagged; } } + private object tagMutex = new object(); + /// /// Assemble a mapping from tags to modules ///