Skip to content

Commit 5eb3efc

Browse files
committed
Fix timeline_value not being marked in test
T_DATA with a NULL pointer are not marked. Let's wrap 1 instead to ensure that our mark function is actually run.
1 parent 4aa74b6 commit 5eb3efc

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

ext/-test-/thread/instrumentation/instrumentation.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
# define RB_THREAD_LOCAL_SPECIFIER
77
#endif
88

9-
static VALUE last_thread = Qnil;
109
static VALUE timeline_value = Qnil;
1110

1211
struct thread_event {
@@ -211,9 +210,8 @@ Init_instrumentation(void)
211210
VALUE mBug = rb_define_module("Bug");
212211
VALUE klass = rb_define_module_under(mBug, "ThreadInstrumentation");
213212
rb_global_variable(&timeline_value);
214-
timeline_value = TypedData_Wrap_Struct(0, &event_timeline_type, 0);
213+
timeline_value = TypedData_Wrap_Struct(0, &event_timeline_type, (void *)1);
215214

216-
rb_global_variable(&last_thread);
217215
rb_define_singleton_method(klass, "register_callback", thread_register_callback, 1);
218216
rb_define_singleton_method(klass, "unregister_callback", thread_unregister_callback, 0);
219217
rb_define_singleton_method(klass, "register_and_unregister_callbacks", thread_register_and_unregister_callback, 0);

0 commit comments

Comments
 (0)