diff options
| author | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2006-06-07 00:19:14 +0000 |
|---|---|---|
| committer | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2006-06-07 00:19:14 +0000 |
| commit | 25590693d6150358ac666f8efa085aeef92ffdb6 (patch) | |
| tree | 2313af7abb63c875b668133bd117c31afeb7b097 /eval.c | |
| parent | 47d295fc3a3faf5c82cbcd65dffa2ce678ba95c2 (diff) | |
| download | ruby-25590693d6150358ac666f8efa085aeef92ffdb6.tar.gz ruby-25590693d6150358ac666f8efa085aeef92ffdb6.tar.xz ruby-25590693d6150358ac666f8efa085aeef92ffdb6.zip | |
* eval.c (rb_call0): binding for the return event hook should have
consistent scope. [ruby-core:07928]
* eval.c (EXEC_EVENT_HOOK): trace_func may remove itself from
event_hooks. no guarantee for arbitrary hook deletion.
[ruby-dev:28632]
git-svn-id: http://svn.ruby-lang.org/repos/ruby/branches/ruby_1_8@10221 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'eval.c')
| -rw-r--r-- | eval.c | 19 |
1 files changed, 12 insertions, 7 deletions
@@ -1128,11 +1128,16 @@ static rb_event_hook_t *event_hooks; #define EXEC_EVENT_HOOK(event, node, self, id, klass) \ do { \ - rb_event_hook_t *hook; \ + rb_event_hook_t *hook = event_hooks; \ + rb_event_hook_func_t hook_func; \ + rb_event_t events; \ \ - for (hook = event_hooks; hook; hook = hook->next) { \ - if (hook->events & event) \ - (*hook->func)(event, node, self, id, klass); \ + while (hook) { \ + hook_func = hook->func; \ + events = hook->events; \ + hook = hook->next; \ + if (events & event) \ + (*hook_func)(event, node, self, id, klass); \ } \ } while (0) @@ -5911,14 +5916,14 @@ rb_call0(klass, recv, id, oid, argc, argv, body, flags) state = 0; } POP_TAG(); + if (event_hooks) { + EXEC_EVENT_HOOK(RUBY_EVENT_RETURN, body, recv, id, klass); + } POP_VARS(); POP_CLASS(); POP_SCOPE(); ruby_cref = saved_cref; if (safe >= 0) ruby_safe_level = safe; - if (event_hooks) { - EXEC_EVENT_HOOK(RUBY_EVENT_RETURN, body, recv, id, klass); - } switch (state) { case 0: break; |
