[前][次][番号順一覧][スレッド一覧]

ruby-changes:63266

From: Koichi <ko1@a...>
Date: Sat, 3 Oct 2020 23:23:24 +0900 (JST)
Subject: [ruby-changes:63266] 0406898a3f (master): add NULL check.

https://git.ruby-lang.org/ruby.git/commit/?id=0406898a3f

From 0406898a3f1d157db0ccf039fe9844c221c65f95 Mon Sep 17 00:00:00 2001
From: Koichi Sasada <ko1@a...>
Date: Sat, 3 Oct 2020 23:22:17 +0900
Subject: add NULL check.

DATA_PTR(ractor) can be NULL just after creation.

diff --git a/gc.c b/gc.c
index 93652ff..3b84026 100644
--- a/gc.c
+++ b/gc.c
@@ -11955,7 +11955,9 @@ rb_raw_obj_info(char *buff, const int buff_size, VALUE obj) https://github.com/ruby/ruby/blob/trunk/gc.c#L11955
 	    }
             else if (rb_ractor_p(obj)) {
                 rb_ractor_t *r = (void *)DATA_PTR(obj);
-                APPENDF((BUFF_ARGS, "r:%d", r->id));
+                if (r) {
+                    APPENDF((BUFF_ARGS, "r:%d", r->id));
+                }
             }
 	    else {
 		const char * const type_name = rb_objspace_data_type_name(obj);
-- 
cgit v0.10.2


--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]