diff options
author | Andy Wingo <wingo@pobox.com> | 2009-04-17 15:18:46 +0200 |
---|---|---|
committer | Andy Wingo <wingo@pobox.com> | 2009-04-17 15:18:56 +0200 |
commit | 17df23e324eec8b8541bdd283e361c19a4159fa3 (patch) | |
tree | 04a97304356c17c185271a18afa01c3484d981fb /libguile/procs.c | |
parent | 6d66647d5b2c6649bb4dade734f6d583d10d797c (diff) | |
download | guile-17df23e324eec8b8541bdd283e361c19a4159fa3.tar.gz |
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.
Diffstat (limited to 'libguile/procs.c')
-rw-r--r-- | libguile/procs.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/libguile/procs.c b/libguile/procs.c index 8230e07ae..b3a0d3215 100644 --- a/libguile/procs.c +++ b/libguile/procs.c @@ -45,15 +45,19 @@ SCM scm_c_make_subr (const char *name, long type, SCM (*fcn) ()) { register SCM z; + SCM sname; SCM *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 */ z = scm_double_cell ((scm_t_bits) type, (scm_t_bits) fcn, 0 /* generic */, (scm_t_bits) meta_info); + scm_remember_upto_here_1 (sname); + return z; } |