diff --git a/ChangeLog b/ChangeLog index 8689aa7aa9..253c4f6e2a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +Wed Sep 1 12:56:36 2010 Nobuyoshi Nakada + + * thread.c (ruby_suppress_tracing): restore the state and invoke + the func with normal state. a patch from Satoshi Shiba at [ruby-dev:42162]. [ruby-core:31783] + Tue Aug 31 17:32:34 2010 Hidetoshi NAGAI * ext/tk/stubs.c: fix [Bug #3771] "VC++ can't make ext/tk with enabling diff --git a/test/ruby/test_trace.rb b/test/ruby/test_trace.rb index 45bc599314..775c458fb1 100644 --- a/test/ruby/test_trace.rb +++ b/test/ruby/test_trace.rb @@ -46,4 +46,16 @@ class TestTrace < Test::Unit::TestCase ensure untrace_var :$x end + + def test_trace_break + bug2722 = '[ruby-core:31783]' + a = Object.new.extend(Enumerable) + def a.each + yield + end + assert(Thread.start { + Thread.current.add_trace_func(proc{}) + a.any? {true} + }.value, bug2722) + end end diff --git a/thread.c b/thread.c index aa6ecede07..4022f60bca 100644 --- a/thread.c +++ b/thread.c @@ -4090,6 +4090,7 @@ ruby_suppress_tracing(VALUE (*func)(VALUE, int), VALUE arg, int always) rb_thread_t *th = GET_THREAD(); int state, tracing; volatile int raised; + volatile int outer_state; VALUE result = Qnil; if ((tracing = th->tracing) != 0 && !always) { @@ -4100,6 +4101,8 @@ ruby_suppress_tracing(VALUE (*func)(VALUE, int), VALUE arg, int always) } raised = rb_threadptr_reset_raised(th); + outer_state = th->state; + th->state = 0; PUSH_TAG(); if ((state = EXEC_TAG()) == 0) { @@ -4115,6 +4118,7 @@ ruby_suppress_tracing(VALUE (*func)(VALUE, int), VALUE arg, int always) if (state) { JUMP_TAG(state); } + th->state = outer_state; return result; } diff --git a/version.h b/version.h index ee4d69c8ba..67603b1412 100644 --- a/version.h +++ b/version.h @@ -1,5 +1,5 @@ #define RUBY_VERSION "1.9.2" -#define RUBY_PATCHLEVEL 27 +#define RUBY_PATCHLEVEL 28 #define RUBY_VERSION_MAJOR 1 #define RUBY_VERSION_MINOR 9 #define RUBY_VERSION_TEENY 1