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:
parent
9d9aea7fe5
commit
c7ddf9d516
2 changed files with 8 additions and 4 deletions
|
@ -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>
|
Sat May 30 08:36:04 2015 Eric Wong <e@80x24.org>
|
||||||
|
|
||||||
* variable.c (static int special_generic_ivar): move
|
* variable.c (static int special_generic_ivar): move
|
||||||
|
|
7
cont.c
7
cont.c
|
@ -236,17 +236,16 @@ cont_free(void *ptr)
|
||||||
else {
|
else {
|
||||||
/* fiber */
|
/* fiber */
|
||||||
rb_fiber_t *fib = (rb_fiber_t*)cont;
|
rb_fiber_t *fib = (rb_fiber_t*)cont;
|
||||||
|
const rb_thread_t *const th = GET_THREAD();
|
||||||
#ifdef _WIN32
|
#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 */
|
/* don't delete root fiber handle */
|
||||||
rb_fiber_t *fib = (rb_fiber_t*)cont;
|
|
||||||
if (fib->fib_handle) {
|
if (fib->fib_handle) {
|
||||||
DeleteFiber(fib->fib_handle);
|
DeleteFiber(fib->fib_handle);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#else /* not WIN32 */
|
#else /* not WIN32 */
|
||||||
if (GET_THREAD()->fiber != fib) {
|
if (th && th->fiber != fib) {
|
||||||
rb_fiber_t *fib = (rb_fiber_t*)cont;
|
|
||||||
if (fib->ss_sp) {
|
if (fib->ss_sp) {
|
||||||
if (cont->type == ROOT_FIBER_CONTEXT) {
|
if (cont->type == ROOT_FIBER_CONTEXT) {
|
||||||
rb_bug("Illegal root fiber parameter");
|
rb_bug("Illegal root fiber parameter");
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue