diff --git a/ChangeLog b/ChangeLog index c10ca38196..33372b3eab 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +Thu Nov 4 02:06:16 2010 Yusuke Endoh + + * cont.c (fiber_t_alloc): raise an error when fiber is going to be + initialized twice. [ruby-dev:42524] + Thu Nov 4 02:04:25 2010 Yusuke Endoh * cont.c (rb_fiber_resume): raise an "double resume" error when root diff --git a/cont.c b/cont.c index b0defcaeb7..56ae843d73 100644 --- a/cont.c +++ b/cont.c @@ -971,6 +971,10 @@ fiber_t_alloc(VALUE fibval) rb_fiber_t *fib; rb_thread_t *th = GET_THREAD(); + if (DATA_PTR(fibval) != 0) { + rb_raise(rb_eRuntimeError, "cannot initialize twice"); + } + THREAD_MUST_BE_RUNNING(th); fib = ALLOC(rb_fiber_t); memset(fib, 0, sizeof(rb_fiber_t));