Don't clear out flags in rb_gc_obj_free
If there's a crash after rb_gc_obj_free, it's hard to debug because the flags have been cleared out already.
This commit is contained in:
parent
20c5a3e133
commit
5131fb5dbe
Notes:
git
2024-10-21 16:49:11 +00:00
1
gc.c
1
gc.c
@ -1314,7 +1314,6 @@ rb_gc_obj_free(void *objspace, VALUE obj)
|
||||
return FALSE;
|
||||
}
|
||||
else {
|
||||
RBASIC(obj)->flags = 0;
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
|
@ -3030,7 +3030,9 @@ rb_gc_impl_shutdown_free_objects(void *objspace_ptr)
|
||||
VALUE vp = (VALUE)p;
|
||||
asan_unpoisoning_object(vp) {
|
||||
if (RB_BUILTIN_TYPE(vp) != T_NONE) {
|
||||
rb_gc_obj_free(objspace, vp);
|
||||
if (rb_gc_obj_free(objspace, vp)) {
|
||||
RBASIC(vp)->flags = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -3102,7 +3104,9 @@ rb_gc_impl_shutdown_call_finalizer(void *objspace_ptr)
|
||||
VALUE vp = (VALUE)p;
|
||||
asan_unpoisoning_object(vp) {
|
||||
if (rb_gc_shutdown_call_finalizer_p(vp)) {
|
||||
rb_gc_obj_free(objspace, vp);
|
||||
if (rb_gc_obj_free(objspace, vp)) {
|
||||
RBASIC(vp)->flags = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user