diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2023-03-22 23:09:55 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2023-03-22 23:09:55 -0700 |
commit | 77c5bb38d3127fffd837893f635da48314a044a0 (patch) | |
tree | c02afd41c94502486a091542874abfcb9d4294ca /stdlib/struct.tl | |
parent | df95115a32034b7c896916df8b068b1e6db796aa (diff) | |
download | txr-77c5bb38d3127fffd837893f635da48314a044a0.tar.gz txr-77c5bb38d3127fffd837893f635da48314a044a0.tar.bz2 txr-77c5bb38d3127fffd837893f635da48314a044a0.zip |
ffi: gc bugfix in ffi_type_struct.
I haven't reproduced a crash with this and --gc-debug
doesn't do it, possibly due to the use of setcheck
in the loop. But make_ffi_type_struct is doing something
wrong: it's creating new compiled type objects in a loop
and sticking them into the memb array, which is not
visible to the garbage collector.
* ffi.c (make_ffi_type_struct): We move the initialization
of ffi->memb to above the loop, so that the object points
to the array. The loop is already setting ft->nelem to
the correct value i + 1 on each iteration of the loop,
thereby revealing each newly populated entry to the garbage
collector.
Diffstat (limited to 'stdlib/struct.tl')
0 files changed, 0 insertions, 0 deletions