mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-05 13:58:04 +02:00
glsl: fix race in instance getters
Insertions can modify entry->data. Seems to fix random Fossilize crashes. Signed-off-by: Rhys Perry <pendingchaos02@gmail.com> Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl> Reviewed-by: Eric Engestrom <eric@engestrom.ch> Reviewed-by: Eric Anholt <eric@anholt.net> CC: <mesa-stable@lists.freedesktop.org> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4335>
This commit is contained in:
parent
f5b14d983e
commit
d101ca3f5a
1 changed files with 15 additions and 5 deletions
|
|
@ -673,9 +673,11 @@ glsl_type::get_instance(unsigned base_type, unsigned rows, unsigned columns,
|
|||
assert(((glsl_type *) entry->data)->matrix_columns == columns);
|
||||
assert(((glsl_type *) entry->data)->explicit_stride == explicit_stride);
|
||||
|
||||
const glsl_type *t = (const glsl_type *) entry->data;
|
||||
|
||||
mtx_unlock(&glsl_type::hash_mutex);
|
||||
|
||||
return (const glsl_type *) entry->data;
|
||||
return t;
|
||||
}
|
||||
|
||||
assert(!row_major);
|
||||
|
|
@ -1034,9 +1036,11 @@ glsl_type::get_array_instance(const glsl_type *base,
|
|||
assert(((glsl_type *) entry->data)->length == array_size);
|
||||
assert(((glsl_type *) entry->data)->fields.array == base);
|
||||
|
||||
glsl_type *t = (glsl_type *) entry->data;
|
||||
|
||||
mtx_unlock(&glsl_type::hash_mutex);
|
||||
|
||||
return (glsl_type *) entry->data;
|
||||
return t;
|
||||
}
|
||||
|
||||
bool
|
||||
|
|
@ -1235,9 +1239,11 @@ glsl_type::get_struct_instance(const glsl_struct_field *fields,
|
|||
assert(strcmp(((glsl_type *) entry->data)->name, name) == 0);
|
||||
assert(((glsl_type *) entry->data)->packed == packed);
|
||||
|
||||
glsl_type *t = (glsl_type *) entry->data;
|
||||
|
||||
mtx_unlock(&glsl_type::hash_mutex);
|
||||
|
||||
return (glsl_type *) entry->data;
|
||||
return t;
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -1271,9 +1277,11 @@ glsl_type::get_interface_instance(const glsl_struct_field *fields,
|
|||
assert(((glsl_type *) entry->data)->length == num_fields);
|
||||
assert(strcmp(((glsl_type *) entry->data)->name, block_name) == 0);
|
||||
|
||||
glsl_type *t = (glsl_type *) entry->data;
|
||||
|
||||
mtx_unlock(&glsl_type::hash_mutex);
|
||||
|
||||
return (glsl_type *) entry->data;
|
||||
return t;
|
||||
}
|
||||
|
||||
const glsl_type *
|
||||
|
|
@ -1300,9 +1308,11 @@ glsl_type::get_subroutine_instance(const char *subroutine_name)
|
|||
assert(((glsl_type *) entry->data)->base_type == GLSL_TYPE_SUBROUTINE);
|
||||
assert(strcmp(((glsl_type *) entry->data)->name, subroutine_name) == 0);
|
||||
|
||||
glsl_type *t = (glsl_type *) entry->data;
|
||||
|
||||
mtx_unlock(&glsl_type::hash_mutex);
|
||||
|
||||
return (glsl_type *) entry->data;
|
||||
return t;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue