diff --git a/ChangeLog b/ChangeLog index 2515d638a6..43ecc955ba 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +Fri Dec 14 08:17:24 2007 Tanaka Akira + + * eval.c (rb_protect): restore root_jmpbuf even if proc exits by + break such as dbm.delete_if { break }. + Fri Dec 14 02:55:41 2007 Yukihiro Matsumoto * string.c (str_nth): direct jump if string is 7bit only. great diff --git a/eval.c b/eval.c index e1b9996c39..555aa2b96e 100644 --- a/eval.c +++ b/eval.c @@ -1176,17 +1176,17 @@ rb_protect(VALUE (*proc) (VALUE), VALUE data, int *state) rb_thread_t *th = GET_THREAD(); rb_control_frame_t *cfp = th->cfp; struct rb_vm_trap_tag trap_tag; + rb_jmpbuf_t org_jmpbuf; trap_tag.prev = th->trap_tag; PUSH_TAG(); th->trap_tag = &trap_tag; + MEMCPY(&org_jmpbuf, &(th)->root_jmpbuf, rb_jmpbuf_t, 1); if ((status = EXEC_TAG()) == 0) { - rb_jmpbuf_t org_jmpbuf; - MEMCPY(&org_jmpbuf, &(th)->root_jmpbuf, rb_jmpbuf_t, 1); SAVE_ROOT_JMPBUF(th, result = (*proc) (data)); - MEMCPY(&(th)->root_jmpbuf, &org_jmpbuf, rb_jmpbuf_t, 1); } + MEMCPY(&(th)->root_jmpbuf, &org_jmpbuf, rb_jmpbuf_t, 1); th->trap_tag = trap_tag.prev; POP_TAG();