aboutsummaryrefslogtreecommitdiffstats
path: root/ext
diff options
context:
space:
mode:
authorAlan Wu <XrXr@users.noreply.github.com>2020-03-11 10:37:14 -0400
committerNARUSE, Yui <naruse@airemix.jp>2020-03-30 19:15:11 +0900
commitb5fa156b7907b8ea1baf8b9f0cb6a66b0fecb3d4 (patch)
treee2551a6cc79b035f1a74e82da2703822e4c08086 /ext
parent0057fe4063b57b445d6ffc893e442f362e3a19e0 (diff)
downloadruby-b5fa156b7907b8ea1baf8b9f0cb6a66b0fecb3d4.tar.gz
Clear all trace events during teardown
Since 0c2d81dada, not all trace events are cleared during VM teardown. This causes a crash when there is a tracepoint for `RUBY_INTERNAL_EVENT_GC_EXIT` active during teardown. The commit looks like a refactoring commit so I think this change was unintentional. [Bug #16682] (cherry picked from commit b385f7670ffa420790bc548747fa4b58c4c5d8f6)
Diffstat (limited to 'ext')
-rw-r--r--ext/-test-/tracepoint/gc_hook.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/ext/-test-/tracepoint/gc_hook.c b/ext/-test-/tracepoint/gc_hook.c
index 2e695a9fba..54b469dcad 100644
--- a/ext/-test-/tracepoint/gc_hook.c
+++ b/ext/-test-/tracepoint/gc_hook.c
@@ -73,8 +73,16 @@ set_after_gc_start(VALUE module, VALUE proc)
"__set_after_gc_start_tpval__", "__set_after_gc_start_proc__");
}
+static VALUE
+start_after_gc_exit(VALUE module, VALUE proc)
+{
+ return set_gc_hook(module, proc, RUBY_INTERNAL_EVENT_GC_EXIT,
+ "__set_after_gc_exit_tpval__", "__set_after_gc_exit_proc__");
+}
+
void
Init_gc_hook(VALUE module)
{
rb_define_module_function(module, "after_gc_start_hook=", set_after_gc_start, 1);
+ rb_define_module_function(module, "after_gc_exit_hook=", start_after_gc_exit, 1);
}