summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorKoichi Sasada <ko1@atdot.net>2019-07-24 05:32:09 +0900
committerKoichi Sasada <ko1@atdot.net>2019-07-24 05:39:09 +0900
commitdf317151a5b4e0c5a30fcc321a9dc6abad63f7ed (patch)
tree89eb41fc15d3d463b662f582c293a34d7d05e739 /test
parenta4e5690760c9177bc4234fdc5152d82ba73d26d0 (diff)
should not free local hook_list here.
exec_hooks_postcheck() clean executed hook_list if it is needed. list_exec is freed if there are no events and this list is local event (connected to specific iseq). However, iseq keeps to point this local hook_list, freed list. To prevent this situation, do not free hook_list here even if it has no events. This issue is reported by @joker1007. https://twitter.com/joker1007/status/1153649170797830144
Diffstat (limited to 'test')
-rw-r--r--test/ruby/test_settracefunc.rb17
1 files changed, 17 insertions, 0 deletions
diff --git a/test/ruby/test_settracefunc.rb b/test/ruby/test_settracefunc.rb
index cfc90f50b7..1f99d3ee88 100644
--- a/test/ruby/test_settracefunc.rb
+++ b/test/ruby/test_settracefunc.rb
@@ -2166,4 +2166,21 @@ class TestSetTraceFunc < Test::Unit::TestCase
tp.enable {obj.example}
assert ok, "return event should be emitted"
end
+
+ def test_disable_local_tracepoint_in_trace
+ assert_normal_exit <<-EOS
+ def foo
+ trace = TracePoint.new(:b_return){|tp|
+ tp.disable
+ }
+ trace.enable(target: method(:bar))
+ end
+ def bar
+ 100.times{|i|
+ foo; foo
+ }
+ end
+ bar
+ EOS
+ end
end