From 15b31b0d80dd9959873d1db0a76e269a556790ac Mon Sep 17 00:00:00 2001 From: ko1 Date: Wed, 6 Jun 2007 01:55:09 +0000 Subject: * cont.c (rb_cont_call): forbid calling dead fiber with Cotinuation#call. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12447 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- cont.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'cont.c') diff --git a/cont.c b/cont.c index 265e743a97..367d033757 100644 --- a/cont.c +++ b/cont.c @@ -344,6 +344,14 @@ rb_cont_call(int argc, VALUE *argv, VALUE contval) if (cont->saved_thread.trap_tag != th->trap_tag) { rb_raise(rb_eRuntimeError, "continuation called across trap"); } + if (cont->saved_thread.fiber) { + rb_context_t *fcont; + GetContPtr(cont->saved_thread.fiber, fcont); + + if (!fcont->alive) { + rb_raise(rb_eRuntimeError, "continuation called dead fiber"); + } + } cont->value = make_passing_arg(argc, argv); -- cgit v1.2.1