<div dir="ltr"><div>Oops, had attached the wrong file, apologies!</div><div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, 20 Dec 2021 at 15:45, Christos Vagias <<a href="mailto:chris.actondev@gmail.com">chris.actondev@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div>Hi Bil,</div><div><br></div><div>I think I found a bug:</div><div>When creating an object with <br></div><div><br></div><div> s7_pointer obj = s7_make_c_object(sc, type_foo, new Foo{});<br> s7_pointer methods = s7_eval_c_string(<br> sc, "(inlet :write foo-write))");<br> // Without gc_protect the c_object loses its methods after gc<br> if(arg_gc_protect == 1) s7_gc_protect(sc, methods);<br> s7_c_object_set_let(sc, obj, methods);<br> return s7_openlet(sc, obj);</div><div><br></div><div>(as the comment says) without gc_protect of the c_object let/methods, the c_object loses its methods after gc.</div><div>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).</div><div><br></div><div>I'm attaching a demo program</div><div>- ./main 0 # no gc_protect, errors</div><div>- ./main 1 # gc_protect, no errors<br></div></div>
</blockquote></div>