Prevent the path for copied extension from GC

This commit is contained in:
Nobuyoshi Nakada 2025-11-08 10:17:07 +09:00
parent 3b588dab91
commit c65f8b6370
No known key found for this signature in database
GPG Key ID: 3582D74E1FEE4465
Notes: git 2025-11-08 01:52:04 +00:00

5
load.c
View File

@ -1207,7 +1207,10 @@ load_ext(VALUE path, VALUE fname)
loaded = rb_box_local_extension(box->box_object, fname, path);
}
rb_scope_visibility_set(METHOD_VISI_PUBLIC);
return (VALUE)dln_load_feature(RSTRING_PTR(loaded), RSTRING_PTR(fname));
void *handle = dln_load_feature(RSTRING_PTR(loaded), RSTRING_PTR(fname));
RB_GC_GUARD(loaded);
RB_GC_GUARD(fname);
return (VALUE)handle;
}
static VALUE