1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

cont.c: Check ruby_current_thread

* cont.c (cont_free): check if ruby_current_thread is still valid.
  [Fix GH-914]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50679 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2015-05-30 00:14:34 +00:00
parent 9d9aea7fe5
commit c7ddf9d516
2 changed files with 8 additions and 4 deletions

View file

@ -1,3 +1,8 @@
Sat May 30 09:14:28 2015 Scott Francis <scott.francis@shopify.com>
* cont.c (cont_free): check if ruby_current_thread is still valid.
[Fix GH-914]
Sat May 30 08:36:04 2015 Eric Wong <e@80x24.org>
* variable.c (static int special_generic_ivar): move

7
cont.c
View file

@ -236,17 +236,16 @@ cont_free(void *ptr)
else {
/* fiber */
rb_fiber_t *fib = (rb_fiber_t*)cont;
const rb_thread_t *const th = GET_THREAD();
#ifdef _WIN32
if (GET_THREAD()->fiber != fib && cont->type != ROOT_FIBER_CONTEXT) {
if (th && th->fiber != fib && cont->type != ROOT_FIBER_CONTEXT) {
/* don't delete root fiber handle */
rb_fiber_t *fib = (rb_fiber_t*)cont;
if (fib->fib_handle) {
DeleteFiber(fib->fib_handle);
}
}
#else /* not WIN32 */
if (GET_THREAD()->fiber != fib) {
rb_fiber_t *fib = (rb_fiber_t*)cont;
if (th && th->fiber != fib) {
if (fib->ss_sp) {
if (cont->type == ROOT_FIBER_CONTEXT) {
rb_bug("Illegal root fiber parameter");