]> git.ipfire.org Git - thirdparty/LuaJIT.git/commitdiff
FFI: Treat cdata finalizer table as a GC root.
authorMike Pall <mike>
Sun, 10 Mar 2024 16:16:41 +0000 (17:16 +0100)
committerMike Pall <mike>
Sun, 10 Mar 2024 16:16:41 +0000 (17:16 +0100)
Thanks to Sergey Bronnikov. #1168

src/lj_gc.c

index 06484f6fac55be3703510f67a614995762cf2d46..9c0d679766a905a26e0d56db5e061c830f975e76 100644 (file)
@@ -93,6 +93,9 @@ static void gc_mark_start(global_State *g)
   gc_markobj(g, tabref(mainthread(g)->env));
   gc_marktv(g, &g->registrytv);
   gc_mark_gcroot(g);
+#if LJ_HASFFI
+  if (ctype_ctsG(g)) gc_markobj(g, ctype_ctsG(g)->finalizer);
+#endif
   g->gc.state = GCSpropagate;
 }