diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2018-03-22 06:54:53 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2018-03-22 06:54:53 -0700 |
commit | 7b6473d3895c94397206913937e93b1aad48952e (patch) | |
tree | 7f36a136ee1b2a3b8d8032d948d61e05a707851a /struct.c | |
parent | d65e7e675b50ea9fbbdd83f3aeffe919af907e5a (diff) | |
download | txr-7b6473d3895c94397206913937e93b1aad48952e.tar.gz txr-7b6473d3895c94397206913937e93b1aad48952e.tar.bz2 txr-7b6473d3895c94397206913937e93b1aad48952e.zip |
gc bugs: incorrect struct init function assignments.
* struct.c (struct_set_initfun, struct_set_postinitfun):
Replace incorrect direct assignments with set macro.
This manifested itself as corruption. I ran into a situation
in which the postinitfun of a struct type was prematurely
reclaimed and the heap object was re-used for something else
wreaking havoc on the postinit call when the struct was
instantiated.
Diffstat (limited to 'struct.c')
-rw-r--r-- | struct.c | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -406,7 +406,7 @@ val struct_get_initfun(val type) val struct_set_initfun(val type, val fun) { struct struct_type *st = stype_handle(&type, lit("struct-set-initfun")); - st->initfun = fun; + set(mkloc(st->initfun, type), fun); return fun; } @@ -419,7 +419,7 @@ val struct_get_postinitfun(val type) val struct_set_postinitfun(val type, val fun) { struct struct_type *st = stype_handle(&type, lit("struct-set-postinitfun")); - st->postinitfun = fun; + set(mkloc(st->postinitfun, type), fun); return fun; } |