diff options
| author | gingerBill <gingerBill@users.noreply.github.com> | 2025-09-26 10:18:46 +0100 |
|---|---|---|
| committer | gingerBill <gingerBill@users.noreply.github.com> | 2025-09-26 10:18:46 +0100 |
| commit | 01c10f3f5eefb0473cce3a0cdd381b6db39cf1bb (patch) | |
| tree | f757fe31f86744b3d1abeb23e05e2a9a2bf8623d /src/check_type.cpp | |
| parent | 42b9039a1fd0307f8b46cd1c750e11db653acea1 (diff) | |
Use `RecursiveMutex` to fix a race condition with parapoly records
Diffstat (limited to 'src/check_type.cpp')
| -rw-r--r-- | src/check_type.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/check_type.cpp b/src/check_type.cpp index 71db34afa..0819de217 100644 --- a/src/check_type.cpp +++ b/src/check_type.cpp @@ -312,6 +312,7 @@ gb_internal void add_polymorphic_record_entity(CheckerContext *ctx, Ast *node, T e->state = EntityState_Resolved; e->file = ctx->file; e->pkg = pkg; + e->TypeName.original_type_for_parapoly = original_type; add_entity_use(ctx, node, e); } @@ -321,8 +322,8 @@ gb_internal void add_polymorphic_record_entity(CheckerContext *ctx, Ast *node, T e->TypeName.objc_metadata = original_type->Named.type_name->TypeName.objc_metadata; auto *found_gen_types = ensure_polymorphic_record_entity_has_gen_types(ctx, original_type); - rw_mutex_lock(&found_gen_types->mutex); - defer (rw_mutex_unlock(&found_gen_types->mutex)); + mutex_lock(&found_gen_types->mutex); + defer (mutex_unlock(&found_gen_types->mutex)); for (Entity *prev : found_gen_types->types) { if (prev == e) { |