зеркало из https://github.com/github/ruby.git
gc.c: never call dmark for NULL
* gc.c (gc_mark_children): call dmark function for non-NULL pointers only, so that DATA_PTR can be NULL safely now. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50462 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
Родитель
280d4c3733
Коммит
f5299e93a7
|
@ -1,3 +1,8 @@
|
|||
Sun May 10 21:32:45 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||
|
||||
* gc.c (gc_mark_children): call dmark function for non-NULL
|
||||
pointers only, so that DATA_PTR can be NULL safely now.
|
||||
|
||||
Sun May 10 16:23:58 2015 Kazuki Tsujimoto <kazuki@callcc.net>
|
||||
|
||||
* proc.c (proc_binding): fix segmentation fault on marking phase.
|
||||
|
|
14
gc.c
14
gc.c
|
@ -4300,12 +4300,14 @@ gc_mark_children(rb_objspace_t *objspace, VALUE obj)
|
|||
break;
|
||||
|
||||
case T_DATA:
|
||||
if (RTYPEDDATA_P(obj)) {
|
||||
RUBY_DATA_FUNC mark_func = any->as.typeddata.type->function.dmark;
|
||||
if (mark_func) (*mark_func)(DATA_PTR(obj));
|
||||
}
|
||||
else {
|
||||
if (any->as.data.dmark) (*any->as.data.dmark)(DATA_PTR(obj));
|
||||
{
|
||||
void *const ptr = DATA_PTR(obj);
|
||||
if (ptr) {
|
||||
RUBY_DATA_FUNC mark_func = RTYPEDDATA_P(obj) ?
|
||||
any->as.typeddata.type->function.dmark :
|
||||
any->as.data.dmark;
|
||||
if (mark_func) (*mark_func)(ptr);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче