diff options
| author | gingerBill <bill@gingerbill.org> | 2023-09-26 12:57:26 +0100 |
|---|---|---|
| committer | gingerBill <bill@gingerbill.org> | 2023-09-26 12:57:26 +0100 |
| commit | d358ebd7e65a885e361af37de5143bfe91b222f4 (patch) | |
| tree | ffa1367ffa601ffce3543c20672355f4f67b1821 /src/check_type.cpp | |
| parent | 9711dd13816330ad9b7be81efbbfd1ffa3d999f4 (diff) | |
Potentially fix race condition #2463 #2814
Diffstat (limited to 'src/check_type.cpp')
| -rw-r--r-- | src/check_type.cpp | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/check_type.cpp b/src/check_type.cpp index cae3ba22e..dd9462ba5 100644 --- a/src/check_type.cpp +++ b/src/check_type.cpp @@ -613,6 +613,9 @@ gb_internal void check_struct_type(CheckerContext *ctx, Type *struct_type, Ast * scope_reserve(ctx->scope, min_field_count); + rw_mutex_lock(&struct_type->Struct.fields_mutex); + defer (rw_mutex_unlock(&struct_type->Struct.fields_mutex)); + if (st->is_raw_union && min_field_count > 1) { struct_type->Struct.is_raw_union = true; context = str_lit("struct #raw_union"); |