mirror of
https://github.com/mruby/mruby
synced 2026-06-08 16:11:16 +00:00
71cb3c2e3a
ROM method tables used static mrb_mt_tbl variables shared across the process. The next pointer in each wrapper was mutated by mrb_mt_init_rom(), causing cross-state contamination when multiple mrb_state instances existed. Allocate mrb_mt_tbl wrappers per-state via mrb_malloc(). The const mrb_mt_entry[] arrays remain static and shared. Wrappers are tracked in mrb->rom_mt and freed at mrb_close(). Remove MRB_MT_ROM_TAB macro; add MRB_MT_INIT_ROM macro that auto-computes size and calls the new mrb_mt_init_rom(). Co-authored-by: Claude <noreply@anthropic.com>