Skip to content

Commit ffb9527

Browse files
authored
Use rb_global_variable to avoid problems with GC.compact (#10)
1 parent ecf2c11 commit ffb9527

2 files changed

Lines changed: 3 additions & 3 deletions

File tree

ext/stack_frames/frame.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,8 @@ DEFINE_FRAME_ACCESSOR(qualified_method_name)
7272

7373
void stack_frame_define(VALUE mStackFrames) {
7474
cFrame = rb_define_class_under(mStackFrames, "Frame", rb_cObject);
75+
rb_global_variable(&cFrame);
76+
7577
rb_define_alloc_func(cFrame, frame_allocate);
7678
rb_define_method(cFrame, "lineno", frame_lineno, 0);
7779
rb_define_method(cFrame, "path", frame_path, 0);

ext/stack_frames/stack_frames.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,8 @@
22
#include "frame.h"
33
#include "buffer.h"
44

5-
VALUE mStackFrames;
6-
75
void Init_stack_frames() {
8-
mStackFrames = rb_define_module("StackFrames");
6+
VALUE mStackFrames = rb_define_module("StackFrames");
97
stack_buffer_define(mStackFrames);
108
stack_frame_define(mStackFrames);
119
}

0 commit comments

Comments
 (0)