THIRFT-5367 Fix crashes when using Ruby compaction GC
Client: rb
Patch: Stan Hu
This closes #2347
diff --git a/lib/rb/ext/compact_protocol.c b/lib/rb/ext/compact_protocol.c
index c0f46b9..fab2170 100644
--- a/lib/rb/ext/compact_protocol.c
+++ b/lib/rb/ext/compact_protocol.c
@@ -567,6 +567,7 @@
static void Init_constants() {
thrift_compact_protocol_class = rb_const_get(thrift_module, rb_intern("CompactProtocol"));
+ rb_global_variable(&thrift_compact_protocol_class);
VERSION = rb_num2ll(rb_const_get(thrift_compact_protocol_class, rb_intern("VERSION")));
VERSION_MASK = rb_num2ll(rb_const_get(thrift_compact_protocol_class, rb_intern("VERSION_MASK")));