diff options
| author | gingerBill <gingerBill@users.noreply.github.com> | 2026-02-02 11:39:17 +0000 |
|---|---|---|
| committer | gingerBill <gingerBill@users.noreply.github.com> | 2026-02-02 11:39:17 +0000 |
| commit | 041ebdd8f6b9cc3c2274ae9284e51d0e70602e00 (patch) | |
| tree | b16757198f2bae31d5cd3d2b2b7a78a4741f10e2 | |
| parent | 813b622dcc8ba6f7b330a310fc324fccb33a2264 (diff) | |
Add parent mutex lock for `scope_insert_with_name`
| -rw-r--r-- | src/checker.cpp | 3 |
1 files changed, 3 insertions, 0 deletions
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); |