[前][次][番号順一覧][スレッド一覧]

ruby-changes:57146

From: nagachika <ko1@a...>
Date: Sun, 18 Aug 2019 14:21:54 +0900 (JST)
Subject: [ruby-changes:57146] nagachika: fb8c28d390 (ruby_2_6): merge revision(s) df317151a5b4e0c5a30fcc321a9dc6abad63f7ed: [Backport #16019]

https://git.ruby-lang.org/ruby.git/commit/?id=fb8c28d390

From fb8c28d3903c6efa15f8b1d2842219666f72982f Mon Sep 17 00:00:00 2001
From: nagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>
Date: Sun, 18 Aug 2019 05:21:34 +0000
Subject: merge revision(s) df317151a5b4e0c5a30fcc321a9dc6abad63f7ed: [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

diff --git a/test/ruby/test_settracefunc.rb b/test/ruby/test_settracefunc.rb
index 6021038..29b69b7 100644
--- a/test/ruby/test_settracefunc.rb
+++ b/test/ruby/test_settracefunc.rb
@@ -2127,4 +2127,21 @@ class TestSetTraceFunc < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/ruby/test_settracefunc.rb#L2127
     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
diff --git a/version.h b/version.h
index f7cc71a..fa078b4 100644
--- a/version.h
+++ b/version.h
@@ -1,6 +1,6 @@ https://github.com/ruby/ruby/blob/trunk/version.h#L1
 #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
diff --git a/vm_trace.c b/vm_trace.c
index 82c5249..f8205db 100644
--- a/vm_trace.c
+++ b/vm_trace.c
@@ -198,9 +198,6 @@ clean_hooks(const rb_execution_context_t *ec, rb_hook_list_t *list) https://github.com/ruby/ruby/blob/trunk/vm_trace.c#L198
     }
     else {
         /* local events */
-        if (list->events == 0) {
-            ruby_xfree(list);
-        }
     }
 }
 
-- 
cgit v0.10.2


--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]