From 041ebdd8f6b9cc3c2274ae9284e51d0e70602e00 Mon Sep 17 00:00:00 2001 From: gingerBill Date: Mon, 2 Feb 2026 11:39:17 +0000 Subject: Add parent mutex lock for `scope_insert_with_name` --- src/checker.cpp | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/checker.cpp') diff --git a/src/checker.cpp b/src/checker.cpp index 9568b8cfa..71ccfebc4 100644 --- a/src/checker.cpp +++ b/src/checker.cpp @@ -495,15 +495,18 @@ gb_internal Entity *scope_insert_with_name(Scope *s, String const &name, Entity goto end; } if (s->parent != nullptr && (s->parent->flags & ScopeFlag_Proc) != 0) { + rw_mutex_shared_lock(&s->parent->mutex); found = string_map_get(&s->parent->elements, key); if (found) { if ((*found)->flags & EntityFlag_Result) { if (entity != *found) { result = *found; } + rw_mutex_shared_unlock(&s->parent->mutex); goto end; } } + rw_mutex_shared_unlock(&s->parent->mutex); } string_map_set(&s->elements, key, entity); -- cgit v1.2.3