mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-05-02 13:00:26 +02:00
(scm_make_struct): Move SCM_CRITICAL_SECTION_END up so that
scm_struct_init is not within that section. scm_struct_init can thrown an error, which within a critical section results in an abort().
This commit is contained in:
parent
3c50d8f109
commit
c8fdac963e
1 changed files with 10 additions and 1 deletions
|
@ -446,8 +446,17 @@ SCM_DEFINE (scm_make_struct, "make-struct", 2, 0, 1,
|
|||
handle = scm_double_cell ((((scm_t_bits) SCM_STRUCT_DATA (vtable))
|
||||
+ scm_tc3_struct),
|
||||
(scm_t_bits) data, 0, 0);
|
||||
scm_struct_init (handle, layout, data, tail_elts, init);
|
||||
SCM_CRITICAL_SECTION_END;
|
||||
|
||||
/* In guile 1.8.1 and earlier, the SCM_CRITICAL_SECTION_END above covered
|
||||
also the following scm_struct_init. But that meant if scm_struct_init
|
||||
finds an invalid type for a "u" field then there's an error throw in a
|
||||
critical section, which results in an abort(). Not sure if we need any
|
||||
protection across scm_struct_init. The data array contains garbage at
|
||||
this point, but until we return it's not visible to anyone except
|
||||
`gc'. */
|
||||
scm_struct_init (handle, layout, data, tail_elts, init);
|
||||
|
||||
return handle;
|
||||
}
|
||||
#undef FUNC_NAME
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue