mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-05-20 19:50:24 +02:00
fix a tricky GC bug in scm_c_make_subr
* libguile/procs.c (scm_c_make_subr): Fix a really tricky bug!!! If scm_double_cell caused GC, the symbolic name wouldn't be marked. But the symptom wouldn't appear until you accessed that symbol much later, for example during tab completion / apropos grovelling. Not sure why we didn't see this earlier.
This commit is contained in:
parent
6d66647d5b
commit
17df23e324
1 changed files with 5 additions and 1 deletions
|
@ -45,15 +45,19 @@ SCM
|
||||||
scm_c_make_subr (const char *name, long type, SCM (*fcn) ())
|
scm_c_make_subr (const char *name, long type, SCM (*fcn) ())
|
||||||
{
|
{
|
||||||
register SCM z;
|
register SCM z;
|
||||||
|
SCM sname;
|
||||||
SCM *meta_info;
|
SCM *meta_info;
|
||||||
|
|
||||||
meta_info = scm_gc_malloc (2 * sizeof (*meta_info), "subr meta-info");
|
meta_info = scm_gc_malloc (2 * sizeof (*meta_info), "subr meta-info");
|
||||||
meta_info[0] = scm_from_locale_symbol (name);
|
sname = scm_from_locale_symbol (name);
|
||||||
|
meta_info[0] = sname;
|
||||||
meta_info[1] = SCM_EOL; /* properties */
|
meta_info[1] = SCM_EOL; /* properties */
|
||||||
|
|
||||||
z = scm_double_cell ((scm_t_bits) type, (scm_t_bits) fcn,
|
z = scm_double_cell ((scm_t_bits) type, (scm_t_bits) fcn,
|
||||||
0 /* generic */, (scm_t_bits) meta_info);
|
0 /* generic */, (scm_t_bits) meta_info);
|
||||||
|
|
||||||
|
scm_remember_upto_here_1 (sname);
|
||||||
|
|
||||||
return z;
|
return z;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue