[前][次][番号順一覧][スレッド一覧]

ruby-changes:38598

From: nobu <ko1@a...>
Date: Sat, 30 May 2015 09:15:06 +0900 (JST)
Subject: [ruby-changes:38598] nobu:r50679 (trunk): cont.c: Check ruby_current_thread

nobu	2015-05-30 09:14:34 +0900 (Sat, 30 May 2015)

  New Revision: 50679

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=50679

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

  Modified files:
    trunk/ChangeLog
    trunk/cont.c
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 50678)
+++ ChangeLog	(revision 50679)
@@ -1,3 +1,8 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Sat May 30 09:14:28 2015  Scott Francis  <scott.francis@s...>
+
+	* 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@8...>
 
 	* variable.c (static int special_generic_ivar): move
Index: cont.c
===================================================================
--- cont.c	(revision 50678)
+++ cont.c	(revision 50679)
@@ -236,17 +236,16 @@ cont_free(void *ptr) https://github.com/ruby/ruby/blob/trunk/cont.c#L236
 	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");

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]