about summary refs log tree commit homepage
diff options
context:
space:
mode:
authorNgan Pham <nganpham@gmail.com>2021-05-24 20:34:36 +0000
committerEric Wong <bofh@yhbt.net>2021-05-25 22:43:32 +0000
commit4db359156adb5aed102ec853f56c030ba40b1eca (patch)
tree21e673f943f75241d5e5f5c27f4d07f805e57122
parente50743e163d65727d26929418a6f31eee9495a6e (diff)
downloadkgio-4db359156adb5aed102ec853f56c030ba40b1eca.tar.gz
Constants defined in Ruby need to be explicitly marked
when made static inside a C extension.

Link: https://yhbt.net/kgio-public/CAAvYYt5Z5f2rMuXO5DMpR1-6uRvu_gXKDvqcyoZ+oNcLiTH39g@mail.gmail.com/T/
Commit-message-by: Eric Wong <e@80x24.org>
-rw-r--r--ext/kgio/accept.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/ext/kgio/accept.c b/ext/kgio/accept.c
index f1de39d..4bd9cfe 100644
--- a/ext/kgio/accept.c
+++ b/ext/kgio/accept.c
@@ -498,9 +498,12 @@ void init_kgio_accept(void)
         rb_define_const(mKgio, "SOCK_CLOEXEC", INT2NUM(SOCK_CLOEXEC));
 
         localhost = rb_const_get(mKgio, rb_intern("LOCALHOST"));
+        rb_gc_register_mark_object(localhost);
         cKgio_Socket = rb_const_get(mKgio, rb_intern("Socket"));
+        rb_gc_register_mark_object(cKgio_Socket);
         cClientSocket = cKgio_Socket;
         mSocketMethods = rb_const_get(mKgio, rb_intern("SocketMethods"));
+        rb_gc_register_mark_object(mSocketMethods);
 
         rb_define_method(mSocketMethods, "kgio_addr!", addr_bang, 0);