Oops, had attached the wrong file, apologies!
On Mon, 20 Dec 2021 at 15:45, Christos Vagias <[email protected]> wrote: > Hi Bil, > > I think I found a bug: > When creating an object with > > s7_pointer obj = s7_make_c_object(sc, type_foo, new Foo{}); > s7_pointer methods = s7_eval_c_string( > sc, "(inlet :write foo-write))"); > // Without gc_protect the c_object loses its methods after gc > if(arg_gc_protect == 1) s7_gc_protect(sc, methods); > s7_c_object_set_let(sc, obj, methods); > return s7_openlet(sc, obj); > > (as the comment says) without gc_protect of the c_object let/methods, the > c_object loses its methods after gc. > I'd assume that since we "set_let" to a value that still is "alive", it's > "let/methods objects" would also not be garbage collected (at least I > assume that the let is getting gc'ed). > > I'm attaching a demo program > - ./main 0 # no gc_protect, errors > - ./main 1 # gc_protect, no errors >
<<attachment: bug-c-object-openlet.zip>>
_______________________________________________ Cmdist mailing list [email protected] https://cm-mail.stanford.edu/mailman/listinfo/cmdist
