summaryrefslogtreecommitdiff
path: root/cont.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-05-30 00:14:34 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-05-30 00:14:34 +0000
commitc7ddf9d5165ff3fd739f1b3f54837899c185a0be (patch)
treea2ad3d5a0a47e66cfca8bc13d86cda3b15cd1b08 /cont.c
parent9d9aea7fe50f6340829faa105d9ffe08ebaee658 (diff)
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
Diffstat (limited to 'cont.c')
-rw-r--r--cont.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/cont.c b/cont.c
index 22e0c5a..703007d 100644
--- a/cont.c
+++ b/cont.c
@@ -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");