1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

merge revision(s) df317151a5: [Backport #16019]

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

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_6@67744 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nagachika 2019-08-18 05:21:34 +00:00
parent 54a470d09e
commit fb8c28d390
3 changed files with 18 additions and 4 deletions

View file

@ -2127,4 +2127,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

View file

@ -1,6 +1,6 @@
#define RUBY_VERSION "2.6.3"
#define RUBY_RELEASE_DATE RUBY_RELEASE_YEAR_STR"-"RUBY_RELEASE_MONTH_STR"-"RUBY_RELEASE_DAY_STR
#define RUBY_PATCHLEVEL 94
#define RUBY_PATCHLEVEL 95
#define RUBY_RELEASE_YEAR 2019
#define RUBY_RELEASE_MONTH 8

View file

@ -198,9 +198,6 @@ clean_hooks(const rb_execution_context_t *ec, rb_hook_list_t *list)
}
else {
/* local events */
if (list->events == 0) {
ruby_xfree(list);
}
}
}