diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2024-01-01 22:10:04 -0800 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2024-01-01 22:10:04 -0800 |
commit | 8f301e63a60fb76b11ca86e23853a3ead6dbf144 (patch) | |
tree | d9ceb05df3159e1a79d282eaa3d28b119b0f821b /lib.c | |
parent | d28977171f795ced690cbbc3ab9bb4f34e02f956 (diff) | |
download | txr-8f301e63a60fb76b11ca86e23853a3ead6dbf144.tar.gz txr-8f301e63a60fb76b11ca86e23853a3ead6dbf144.tar.bz2 txr-8f301e63a60fb76b11ca86e23853a3ead6dbf144.zip |
iter_begin: gc problem.
Also affects seq_begin.
* lib.c (seq_begin, iter_begin): We must gc_protect the
incoming obj also, not only the iter. Both these pointers
are in the seq_info_t structure which is no longer used
at the time the iterator is being allocated by the call
to cobj, and so may be prematurely garbage collected.
Diffstat (limited to 'lib.c')
-rw-r--r-- | lib.c | 2 |
1 files changed, 2 insertions, 0 deletions
@@ -1195,6 +1195,7 @@ val seq_begin(val obj) iter = si->ui.iter; si_obj = cobj(coerce(mem_t *, si), seq_iter_cls, &seq_iter_ops); gc_hint(iter); + gc_hint(obj); return si_obj; } @@ -1250,6 +1251,7 @@ val iter_begin(val obj) iter = si->ui.iter; si_obj = cobj(coerce(mem_t *, si), seq_iter_cls, &seq_iter_ops); gc_hint(iter); + gc_hint(obj); return si_obj; } } |