diff options
-rw-r--r-- | libguile/ChangeLog | 5 | ||||
-rw-r--r-- | libguile/goops.c | 9 |
2 files changed, 11 insertions, 3 deletions
diff --git a/libguile/ChangeLog b/libguile/ChangeLog index 3e7b39820..cce8dbb3b 100644 --- a/libguile/ChangeLog +++ b/libguile/ChangeLog @@ -1,6 +1,9 @@ 2008-04-10 Andy Wingo <wingo@pobox.com> - * libguile/goops.c (get_slot_value, set_slot_value): In the struct + * goops.c (wrap_init): Initialize 'u' slots to 0, not some random + SCM value. + + * goops.c (get_slot_value, set_slot_value): In the struct allocation case, don't poke the slots array directly -- we should go through struct-ref/struct-set! code so that we get the permissions and allocation ('u' versus 'p') correct. diff --git a/libguile/goops.c b/libguile/goops.c index a6769cd15..abb96abce 100644 --- a/libguile/goops.c +++ b/libguile/goops.c @@ -1507,10 +1507,15 @@ static SCM wrap_init (SCM class, SCM *m, long n) { long i; + scm_t_bits slayout = SCM_STRUCT_DATA (class)[scm_vtable_index_layout]; + const char *layout = scm_i_symbol_chars (SCM_PACK (slayout)); - /* Set all slots to unbound */ + /* Set all SCM-holding slots to unbound */ for (i = 0; i < n; i++) - m[i] = SCM_GOOPS_UNBOUND; + if (layout[i*2] == 'p') + m[i] = SCM_GOOPS_UNBOUND; + else + m[i] = 0; return scm_double_cell ((((scm_t_bits) SCM_STRUCT_DATA (class)) | scm_tc3_struct), |